Introduction

As we know, ASP.NET MVC 4 came out. And now everyone is very excited to use it. I have read a release notes from ASP.NET MVC 4 website and found out some cool stuff there. At the 4th version, M$ introduced many features, such as Http programming model, routing, model binding, validation, Query composite, IoC container, self-host for Web API, Bundle and minification, Mobile, asynchronous programming,... I really love the improving for the Razor view engine (it called automatically removing null value when some values in view model got null, and this features actually make us avoid a lot of mistakes in programming time), Web API cannot be believable (hope it will be a standard web soon). Moving from Microsoft's JSON to the Newtonsoft.JSON.4.5.1 third-party library is the big changes as well.

Building the Sample

I am trying to using Visual Studio 2012 for building up a Magazine website that including a front page and an admin page. It is the actually small example to visualize new technologies that I have learned, so I try to make it as simple as possible.

I used EF 5.0 Beta in this sample and got the sample from my former team leader for building the EF persistence layer. Thanks, Mr. Huy Nguyen for that great EF framework sample. To adapting with my code, I also have to edit some code in this framework to matching with new EF 5.0 release.

For the layout, I used some templates for the front-end page and the admin page from the internet. Thanks for your great templates :)

Upgrade

I am working on upgrading this example. The next version of it will use Visual Studio 2013 RTM, ASP.NET MVC 5, Web API 2 and AngularJS)

The source code can find out at https://github.com/thangchung/magazine-website-mvc-5 and https://github.com/thangchung/magazine-website 

The new admin template using Bootstrap 3 can be found at http://saka-webstack.github.io/templates/new-admin-layout/index.html

Front-end page


 

Demo site

The newest source code will come to the MSDN code very soon. At the moment, I just want to introduce the demo pages for it as below

The front-end page: http://magazinewebsitelite.apphb.com

Description

We have the front page like this

 And the admin page as below

How to run the web application:

Step 1: Get a source code from the MSDN code

Step 2: Run a database script, the script can be found at C#\1.DatabaseScripts\3.NewsDbScript.sql

Step 3: Host a CIK.News.Web solution to an IIS host

Step 4: Press F5 to building all solutions

Step 5: Changing a connection string to your own database server.

Step 6: Running it

Structure of solutions:

History:

1.0: finished the draft version

1.1: removed some redundant code that commented from the community. Fixed bug, and removed the complex security model and changed it to the simple one. Re-structure the architecture of the application

1.2: edited some contents in this site