Click here to Skip to main content
15,891,811 members
Articles / Web Development / ASP.NET
Tip/Trick

ASP.NET 5 - Create Web Application Step by Step

Rate me:
Please Sign up or sign in to vote.
3.42/5 (9 votes)
3 Jan 2016CPOL2 min read 36.2K   15   1
Using MVC, Entity Framework, ASP.NET Scaffolding you can create a web application that stores your information. This demo shows you how to create an ASP.NET 5 web application with MVC and Entity Framework 7.

Introduction

Using MVC, Entity Framework, ASP.NET Scaffolding you can create a web application that stores your information. This demo shows you how to create a ASP.NET 5 web application with MVC and Entity Framework 7.

STEP 1 - Create ASP.NET 5 Web Application

  • Open Visual Studio 2015 and create a new project of type ASP.NET 5 Web Application.
  • In this project, I create a solution called Demo.

Image 1

  • Press OK, and a new screen will appear, with several options of template to use on our project.
  • Select the option MVC.

Image 2

After selection of our template, your first web application using ASP.NET 5 is created.

Image 3

STEP 2 - Create Data Model

After we have our web application created, we need to create our data model.

For that, select the option Add New Item on solution and choose the option Class. Create the class like the one on the image above.

Image 4

STEP 3 - Scaffolding

This could be made easily using the Scaffolding functionality.

On the solution on the top of controller folder, select the option Add New Scaffold Item.

On the new screen, select the option MVC6 Controller with views using entity framework.

Image 5

Select the name of the controller, class model and data context class.

Image 6

The new controllers and views associated, was created with success.

Image 7

STEP 4 - Change Menu Layout

To test the two tables, we can add two new entries on the web application menu.

Image 8

STEP 5 - Run Application

Press now the F5 button, to run the web application.

The new entities appear on the menu.

Image 9

Press the option car to see our entity in action

An message error will appear saying that the entity doesn't exist on internal database and that we need to create it using some commands on package manager console.

Image 10

Execute the commands like on the image above and try again.

Image 11

An that's it! Now it's working.

Image 12

Resources

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Devscope
Portugal Portugal
I am João Sousa, and since i finish my degree I’m working in software development using Microsoft technologies.

I was awarded

Microsoft Most Valuable Professional (MVP) 2015 – .Net

My profissional profile:

Azure Developer
.NET Developer

My Certifications:

MCTS - .NET Framework - Application Development Foundation
MCTS - .NET Framework 2.0 - Windows-based Client Development
MCTS - .NET Framework 3.5 ADO.NET Applications
MCTS - .NET Framework 3.5 ASP.NET Applications
MCSD - Programming in HTML5 with JavaScript and CSS3
MCSD - Developing ASP.NET MVC 4 Web Applications
MCSD - Developing Windows Azure and Web Services
MCSA Office 365 - Managing Office 365 Identities and Requirements
MCSA Office 365 - Enabling Office 365 Services
MCSD - Implementing Microsoft Azure Infrastructure Solutions

Comments and Discussions

 
GeneralMy vote of 5 Pin
Camilo Reyes21-Dec-15 12:20
professionalCamilo Reyes21-Dec-15 12:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.