ASP.NET MVC Imran Rashid CTO at ManiWeber Technologies
Outline What is MVC? ASP.NET MVC Create ASP.NET MVC Application
What is MVC?
What is MVC? The Model-View-Controller (MVC) is an architecture that separates an application into three main logical components: Model View Controller Each of these components are built to handle specific development aspects of an application MVC is one of the most frequently used industry-standard web development framework to create scalable and extensible projects
What is MVC? MVC Components
What is MVC? Model The Model component corresponds to all the data-related logic that the user works with This can represent either the data that is being transferred between the View and Controller components or any other business logic-related data For example, a Customer object will retrieve the customer information from the database, manipulate it and update it data back to the database or use it to render data View The View component is used for all the UI logic of the application
What is MVC? For example, the Customer view will include all the UI components such as text boxes, dropdowns, etc. that the final user interacts with Controller Controllers act as an interface between Model and View components to process all the business logic and incoming requests, manipulate data using the Model component and interact with the Views to render the final output For example, the Customer controller will handle all the interactions and inputs from the Customer View and update the database using the Customer Model The same controller will be used to view the Customer information/data
ASP.NET MVC
ASP.NET MVC History ASP.NET 1.0 was released on January 5, 2002, as part of .Net Framework version 1.0 At that time, it was easy to think of ASP.NET and Web Forms as one and the same thing ASP.NET has however always supported two layers of abstraction: System.Web.UI The Web Forms layer, comprising server controls, ViewState, and so on System.Web It supplies the basic web stack, including modules, handlers, the HTTP stack, etc
ASP.NET MVC ASP.NET MVC? ASP.NET MVC is basically a web development framework from Microsoft announced in 2007 (released in 2009) Which combines the features of MVC (Model-View-Controller) architecture & best parts of the existing ASP.NET platform It is not something, which is built from ground zero It is a complete alternative to traditional ASP.NET Web Forms It is built on the top of ASP.NET, so developers enjoy almost all the ASP.NET features while building the MVC application
Model Controller View ASP.NET MVC MVC (Model View Controller) Flow Diagram https://www.google.com/ Model Request Data Controller Browser Response Database View Web Pages (.cshtml)
Create ASP.NET MVC Application
Create ASP.NET MVC Application Step 1 − Open the Visual Studio & Click File → New → Project menu option A New Project dialog opens:
Create ASP.NET MVC Application Step 2 − From left, select Templates → Visual C# → Web Step 3 − In the middle, select ASP.NET Web Application Step 4 − Enter the project name MVCFirstApp
Hint: Student & Teacher Inheritance ASSIGNMENT Submission Date 21/01/2019 & email Q1: Create an ASP.NET MVC application which uses multiple class objects data and pass that data to view and print both classes data on view as well Hint: Student & Teacher Inheritance
Any ?