I began to work on some small project and currently thinking about best approaches in architecture. Assume I have a class with a lot of properties that I retrieve in controller from my database.
Building building = BuildingsBLL.GetBuilding(buildingID);
Buildings are of different types with different sets of properties.
I see two options:
I can pass
Buldingto common view with a lot of code and show / hide specific blocks on the page according to the building type (using if building type blablabla...). OrI can cast building to another type (
SchoolorHospitalor smth else) and pass it to certain view with minimal amount of code.
So in the first case I need just one view and no models(?) and in the second case I need separate model and view for each building type.
In my opinion the second case is preferable. But maybe I'm missing something and aforementioned approaches are not usable at all?
if(item is Skyscraper) { Html.RenderPartial("SkyscraperDetail.ascx", item); }iirc. Pardon the old MVC syntax, I haven't worked in newer versions yet.