Friday 11 April 2014

Web API

After looking at the link below (MVC + WebAPI + SQL), i now finally decide to make a similar page for Schedule.

http://azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-rest-service-aspnet-api-sql-database/#bkmk_addcontroller

Business Logic Layer






Views


Model


Controller


Thursday 10 April 2014

MVC basics

If you create a new ASP.NET MVC 3 web application by visual studio 2010, the initial page will show like below.





Why does it show Views\Home\Index.cshtml by default?
It is defined in global.asax.cs.


If you change the route, initial page will show About View.


This is actually the mistake or misconception I have again and again. I was expecting to see the file Home/About.cshtml when I type in url, localhost/Home/About. No way.


What happen is, the url looks up HomeController.cs and About() function. Because it cannot find the function, it returns 'The resource cannot be found' error.


Just type in About() function as below for testing. 


Voila! You are now looking at the view, View\About.cshtml.

RenderBody()

Good diagrams: