Custom Mayando site pages with C# server side logic?

May 9, 2011 at 5:52 PM

I have setup Mayando via Web Matrix and love it.  I would like to enhace my Photo Blog with some custom code, such as Google Maps, on a custom page or within a page created in Mayando.  How easy is it to do that?  I can see where I can include HTML on a page created through Mayando, but I would like to do more than that.

Thanks,

   Chris

Coordinator
May 16, 2011 at 9:40 AM

Hi Chris,

Mayando is built on ASP.NET MVC (1.0) so it should be easy enough if you know how that works. If not, you can find a lot of learning resources at http://www.asp.net/mvc.

In a nutshell, if you want to include custom code you will have to modify the model (i.e. the data being displayed), the controller (i.e. the logic that creates the model) and the view (i.e. the HTML). For example, if you want to add something to a photo page, you will probably have to add properties to the PhotoViewModel class (in ViewModels/PhotoViewModel.cs). Then modify the PhotosController (in Controllers/PhotosController.cs) so that you fill in the extra properties inside the ViewForPhoto method. Then you can change the view to display the additional properties, e.g. in Views/Shared/PhotoDetails.ascx (or any of the other photo details views, depending on where you want to show your stuff).

I hope that helps,

Jelle