I am trying to create a web application mvc asp dotnet 4 razor.
I would like to put multiple views in a model.
To make it clearer, here is my Model, my eyesight and my controller.
My Model: two tables : Malades and Consultations
public DbSet<Malade> Malades { get; set; }
public DbSet<Consultation> Consultations { get; set; }
My Controller:
public ActionResult Index()
{
if (User.Identity.IsAuthenticated)
{
return View();
}
return RedirectToAction("Login", "Account");
}
My ContentViewModel:
public class ViewModelProfil
{
public List<Malade> Malades { get; set; }
public List<Consultation> Consultations { get; set; }
}
My view:
...
@foreach(var item in Model.Malades)
{
@Html.DisplayNameFor(modelItem => item.Nom)
}
@foreach(var item in Model.Consultations)
{
@Html.DisplayNameFor(modelItem => item.Nombre)
}
...
I want to clarify that the data is not manually integrate into the database, but it is a user who filled out a form for the data to be stored in the database.
Thank you for your help.