Introduction

As we know, ASP.NET MVC 4 came out. And now everyone is very excited to using it. I have read a release notes from ASP.NET MVC 4 website, and found out some cool stuffs 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 programing,... 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 to avoid a lot of mistakes in programming time), Web API cannot be believable (hope it will be a stardard web soon). Moving from M$'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 the front page and the admin page. It is actually the small example to visualize the new technologies that I have learnt, 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 teamleader 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 page from the internet. Thanks you for the great templates :)

Demo site

The newest source code will come to the MSDN code very soon. At the moment, I just want to introducing 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