I register my attributes of the Reserve class, logged in as an Administrator. I would like to know how I can list these reservations by a specific administrator?
Example: Administrator 1, registered 2 reservations. Administrator 2, registered 3 reservations.
How to show in the View, the reservations registered? For in the way that mine is, it simply shows all reservations. It does not matter which administrator is logged in.
Reservation List Method:
public ActionResult Index()
{
return View(db.Reservas.ToList());
}
In View, I use this Model:
@model IEnumerable<FoodInTime.Models.Reserva>
Reserve Class:
public class Reserva
{
[Key]
public int ReservaID { get; set; }
[Required(ErrorMessage = "Preencha o horário para reserva")]
[DisplayName("Horário")]
[DataType(DataType.Time)]
public string Horario { get; set; }
[Required(ErrorMessage = "Preencha o limite de pedidos/hora")]
[DisplayName("Limite de Pedidos/Hora")]
public int LimitePedidos { get; set; }
[Required(ErrorMessage = "Preencha a mesa")]
[DisplayName("Mesa")]
[StringLength(10, MinimumLength = 1, ErrorMessage = "A mesa deve ter no máximo 10 caracteres")]
public string Mesa { get; set; }
[Required(ErrorMessage = "Preencha o valor da reserva")]
[DisplayName("Valor")]
public double Valor { get; set; }
public virtual ICollection<Restaurante> Restaurantes { get; set; }
}