Wednesday, 30 March 2016

Getting Started with ASP.NET MVC 5

This tutorial will teach you the basics of building an ASP.NET MVC 5 web app using Visual Studio 2013.


Getting Started

Start by installing and running Visual Studio Express 2013 for Web or Visual Studio 2013.
Visual Studio is an IDE, or integrated development environment. Just like you use Microsoft Word to write documents, you'll use an IDE to create applications. In Visual Studio there's a toolbar along the top showing various options available to you. There's also a menu that provides another way to perform tasks in the IDE. (For example, instead of selecting New Project from the Start page, you can use the menu and selectFile > New Project.)


Creating Your First Application

Click New Project, then select Visual C# on the left, then Web and then select ASP.NET  Web Application. Name your project "MvcMovie" and then click OK.

In the New ASP.NET Project dialog, click MVC and then click OK.




Visual Studio used a default template for the ASP.NET MVC project you just created, so you have a working application right now without doing anything! This is a simple "Hello World!" project, and it's a good place to start your application.


Click F5 to start debugging. F5 causes Visual Studio to start IIS Express and run your web app. Visual Studio then launches a browser and opens the application's home page. Notice that the address bar of the browser says localhost:port# and not something like example.com. That's because localhost always points to your own local computer, which in this case is running the application you just built. When Visual Studio runs a web project, a random port is used for the web server. In the image below, the port number is 1234. When you run the application, you'll see a different port number.


Right out of the box this default template gives you  Home, Contact and About pages. The image above doesn't show the HomeAbout andContact links. Depending on the size of your browser window, you might need to click the navigation icon to see these links.




Monday, 28 March 2016

ASP.NET Introduction


ASP.NET is a development framework for building web pages and web sites with HTML, CSS, JavaScript and server scripting.
ASP.NET supports three different development models:
Web Pages, MVC (Model View Controller), and Web Forms

THIS TUTORIAL COVERS MVC

The MVC Programming Model

MVC is one of three ASP.NET programming models.
MVC is a framework for building web applications using a MVC (Model View Controller) design:
  • The Model represents the application core (for instance a list of database records).
  • The View displays the data (the database records).
  • The Controller handles the input (to the database records).
The MVC model also provides full control over HTML, CSS, and JavaScript.

The MVC model defines web applications with 3 logic layers:

The business layer (Model logic)
The display layer (View logic)
The input control (Controller logic)




The Model is the part of the application that handles the logic for the application data.
Often model objects retrieve data (and store data) from a database.

The View is the parts of the application that handles the display of the data.
Most often the views are created from the model data.

The Controller is the part of the application that handles user interaction.
Typically controllers read data from a view, control user input, and send input data to the model.


The MVC separation helps you manage complex applications, because you can focus on one aspect a time. For example, you can focus on the view without depending on the business logic. It also makes it easier to test an application.

The MVC separation also simplifies group development. Different developers can work on the view, the controller logic, and the business logic in parallel.