So I'm working on a MVC umbraco project however I'm quite confused how to use MVC in the right way in Umbraco with controllers. For example, I'm building a newsmodule. So I create a document type "NewsItem" in Umbraco with a view as template. I have a news overview page, which shows newsitems with pagination. I could write the news overview as a partial view but then the partial view would have too much logic in it. So what I did:
I created a news page ( document type content page )
I created a newscontroller with an actionresult method "index" which has a querystring as parameter.
I created a News Model, In the controller I map the newsitem document to the news model.
The index method returns a view with a list of newsitem as model.
I create a macropartial which only includes the call to the controller. ( @Html.Action("Index", "News", new { query = Request.QueryString["index"]} )
I add the macropartial to the news page. ( and it will call the controller with the querystring and render the action result of the controller. )
It works, but I'm not sure if I'm doing it the correct way.. What also bothers me is that you usally have a detail method in a controller which returns a view with one newsitem as model. But I already have a detailpage for the newsitem because the document type "NewsItem" has a template. I tried to implement this anyways, just to see if it works. So I created the method and tried to return a view which has a master view. However I get an error saying that the Model is not valid.. And whenever I delete the master view from the detail view it works again. So I probably get this error because the master view expects an IPublishedContent model but I give the detail view a NewsItem model.
So I'm hoping someone can provide me with info how to work with MVC in umbraco.. cause I'm not able to find any good tutorials with MVC and I have the idea that I'm not working in the correct way with MVC.
Umbraco MVC? Confused how to use the controller
So I'm working on a MVC umbraco project however I'm quite confused how to use MVC in the right way in Umbraco with controllers. For example, I'm building a newsmodule. So I create a document type "NewsItem" in Umbraco with a view as template. I have a news overview page, which shows newsitems with pagination. I could write the news overview as a partial view but then the partial view would have too much logic in it. So what I did:
is working on a reply...