I am developing a multi-layered, using ASP.NET MVC 3 and Entity Framework. I have an entity called “Site” which belongs to the domain layer. It is acceptable to mention directly in a domain entity viewmodel and the views?
ViewModel
public IList <Domain.Entities.Site> Sites;
View
foreach (var item in Model.Sites)
{
...
}
Typically not. The point of a ViewModel is to abstract only the information needed from the Model.
You should have a ViewModel that also corresponds to the Site model.
So you would have: