I am currently working in ASP.NET MVC 4 while using the entity framework. I’ve never worked with MVC before, and have build a project with the following layers:
- GUI (Models,Views, Controllers,…)
- DAL (entity database and Repository + IRepository)
- BL (with my queries)
- COMMON
- WCF
- TESTING
Now, I’m trying to write a query in my BL which uses a model from my GUI-layer. As you can’t simply reference to the GUI, I don’t really know what to do here.
Here’s the code from what I’m trying to to:
In my BL:
public static List<PSNAdres> GetAdres(IZoekRepository repo)
{
List<PSNAdres> lijstTypes = (from t in repo.PSNAdres
select new PSNAdres {t.Gemeente, t.Straat, t.Postcode}).ToList();
return lijstTypes;
}
As I said: I am new to MVC. This layer-lay-out is what our MVC-specialist has told us to use as this is how he works.
I am not sure what you ask for, but here is my answer. Simple scenario for presenting address list:
View models:
BL:
Controller