EPiServer noob here. I've done plenty with ASP.NET and MVC so I'm not entirely new to enterprise web apps. I have 7 installed locally and it's mostly working ok with my Visual Studio project. Creating page types and all has been no problem. I'm trying to see if I can run a pure MVC 4 Razor site. What I can't seem to figure out is how to set up a template the CMS recognizes and I can set a Page Type's template to. How do you add an item to the MVC template drop down in CMS?
the templates are pulled from the controllers. so you should have controller : basecontroller<pagetypemodel>. this will register in the dropdown for templates.
The general idea is that you create content type (this is your model), razor view for this type (view) and controller<yourcontenttype> (which is considered as template). Probably you will also have to add some configuration to make razor work with your model.
I blogged about creating simple add-on with shared block that supports MVC and Web Forms rendering. The code was written for EPiServer 7 Preview, but the ideas stay the same. You can also find example of razor engine configuration in "MVC block rendering" subsection. You probably don't need that tricks with helping MVC to find the view in add-on folder, when your views are deployed in standard locations for MVC views.
There is couple of helpful articles in SDK:
Pages, Page Types and Page Templates
Blocks, Block Types and Block Templates
Creating Page Templates and Block Controls
Editing hints in MVC
Don't forget about proper client resources handling in your templates.
Thanks for the responses. I was able to get a template to show up in CMS. Now I'm getting a YSOD with this message:
Seems odd to me that the CMS is yellow screening but my project compiles with no issues.
When you return your model to the view, what type are you returning, by the looks of it, your returning the MyPageProxy and your view is looking for MyPageViewModel. More code would also be helpful
Ahhh!!! Good catch Joshua. I changed the model to MyPage (a type) and now it appears to be working. Seems with the step of setting up a page type on top of the model kinda threw me off. I think I was trying to not let the EPiServer extensions do their job.
Remember that in MVC, theres no magic when creating somthing from a Visual studio template, so feel free to just create a standard razor for your view and a standard c# class for youre controllers.