4
I register my attributes from the Reserve class, logged in as an Administrator. I would like to know how to list these registered reservations, by a specific administrator?
Example: Administrator 1, registered 2 reservations. Administrator 2, registered 3 reservations.
How to show in View, registered reservations? Because in the way mine is, it simply shows all reservations. It doesn’t matter which administrator is logged in.
Method of Listing Reservations:
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; }
}
How is your class
Reserva
?– Thiago Lunardi
Is just above.
– Allan Fernandes