nit

nit

  • NA
  • 1
  • 1.7k

how to return multiple entity framework models to the view

Apr 4 2013 5:56 AM
This is the action in the controller where i'm trying to pass a single entity model to the view.




public ActionResult Appointment()
        {
            return view(dt.sometable.ToList());
        }


This is the view page where i'm using the model sent from the action. I'm using the razor tag to display the values from the model.


@model IEnumerable<MyProject.Models.sometable>
@foreach (var item in Model)
{
@item.lname
}
           





Now. My query is. I want to send 2 entity models from my action to the view.  I want to use the data from both the entity models in my view page.


Please provide a solution.


Thank you

Answers (1)