1
Reply

how to return multiple entity framework models to the view

Ask a question
nit

nit

11 years ago
1.5k
1
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)
Next Recommended Forum