Gaurav Kumar Arora Twitter - #g_arora Gaurav is an enthusiast Technologist. He is an author of http://c-sharpcorner.com , having more than 13yrs experience in the industry
ASP.NET MVC – SERIES FOR BEGINERS: PART-1
ATTENTION This is a first session of our Beginners series. We will discuss very basic topics in this session. I would like to make this session more interactive, do participate and make this session more presentable. Compile your views, which you want to add and send me I will publish all with your name.
AGENDA  Introduction to MVC  Why MVC?  Reason to choose MVC against asp.net web forms  Overview of Model View Controller  Overview working of MVC  Overview of routes collection  Revisiting session  Question / Answer / Suggestion
INTRODUCTION TO MVC A background to Asp.Net MVC:  Is based on Asp.Net  A framework for RAD (rapid application development), used to develop Web application  Is a composition of Model, View Controller  Is an open source and code is available at CodePlex [In 2009 – released under Microsoft Public License and in 2012 – released under Apache License 2.0]
WHY MVC? Take a moment and think about a valuable Software Pattern Model-view-controller. We can also predicts from the image that MVC pattern divides a software application into a three interconnected parts/components. Basically, it’s a concept of separation (here just separation of internal representation of information from ways/logics/techniques how it is being represented to the end-user)
WHY MVC? Controller can send commands/directions to the model to update its state as well as commands over to view. Associated views and controller get notified by Model as per changes of its state. Model provides specific result as a output upon the request of View to represent.
WHY MVC? Lets understand this from associated image In simple words, we can say that MVC is providing a facility to make our layers separate which are separated and interacting with each-other.
ASP.NET MVC OVER ASP.NET WEBFORMS There are numerous reasons to choose Asp.Net for web development over Asp.Net WebForms:  Asp.Net MVC is a web framework and is based on MVC pattern  No viewstate (performance is better in asp.net mvc)  Completely testable  Integration with client side (easily handshake with client side scripting like Jquery etc.)  Flexibility (provides various views engines, which renders HTML – Razor View Engine is most famous)
OVERVIEW OF MODEL VIEW CONTROLLER Devs we have already covered this in previous slides, lets discuss it again.
OVERVIEW OF MODEL VIEW CONTROLLER Conclusion - what we discussed (for asp.net mvc framework) What is a Model?  MVC model is typically a class (of C# or VB.NET).  Both controller and view can access model.  A model can be used to pass data from Controller to view  Main purpose of a view is to display data in page with the use of model.
OVERVIEW OF MODEL VIEW CONTROLLER Conclusion - what we discussed (for asp.net mvc framework) What is a View?  View is nothing but a page you can say a web page and it is not having any code-behind  All page specific HTML generation and formatting can be done inside view  A request to view can be made only from a controller’s action method
OVERVIEW OF MODEL VIEW CONTROLLER Conclusion - what we discussed (for asp.net mvc framework) What is a Controller?  Controller is typically a class (of C# or VB.Net) and inherits "system.mvc.controller"  Within this class methods can be implemented and called as action methods. These are responsible for responding to browser and/or calling views.  Controller class can access and use model class to pass data to views
OVERVIEW WORKING OF MVC In this session we are not going to cover only basic things: High level overview says – browser sends request to Asp.Net MVC and it returns response back to browser [request is HTTP Request and response is HTTP response]. Lets discuss shown image:
OVERVIEW WORKING OF MVC In broader way – First request comes to Route Tables then passes to specific controller before interaction with Model Binding it goes through Authentication & Authorization and afterwards Fires a specific Action Method and execute the results to View. Lets take an example to discuss more.
OVERVIEW OF ROUTES COLLECTION In simple words, routes collection (also can say Route table) is nothing but a collection of different routes. What is route? A system works on pattern matching mechanism. A route match incoming request to meet a specific pattern and allows once matched else denied. What happened at runtime? At runtime, routing engine uses route table (contains different routes) to match incoming urls with the defined route patterns (url patterns).
OVERVIEW OF ROUTES COLLECTION In above image, url will be processed if any match found else it will throw the HTTP Status code Not Found (404 error).
REVISIT SESSION In this very first session we covered:  Basics of MVC  Discussed MVC pattern  Discussed basics of MVC architecture  Discussed basics of route collection / route table  Read here: ASP.Net MVC Series For Beginners: Part 1
QUESTION/ANSWER Surely, you should have questions, it is hard to discuss all the questions, please compile your questions and shoot me an email.
FEEDBACK This is a series of sessions, today we covered very basics of asp.net mvc part. In coming session we will cover new and some advanced topics. Your feedback is very important. Provide your feedback so, I can share more worthful things with you.
CONTINUES… Lets meet in next session …

ASPNet MVC series for beginers part 1

  • 1.
    Gaurav Kumar Arora Twitter - #g_arora Gaurav is an enthusiast Technologist. He is an author of http://c-sharpcorner.com , having more than 13yrs experience in the industry
  • 2.
    ASP.NET MVC –SERIES FOR BEGINERS: PART-1
  • 3.
    ATTENTION This isa first session of our Beginners series. We will discuss very basic topics in this session. I would like to make this session more interactive, do participate and make this session more presentable. Compile your views, which you want to add and send me I will publish all with your name.
  • 4.
    AGENDA  Introductionto MVC  Why MVC?  Reason to choose MVC against asp.net web forms  Overview of Model View Controller  Overview working of MVC  Overview of routes collection  Revisiting session  Question / Answer / Suggestion
  • 5.
    INTRODUCTION TO MVC A background to Asp.Net MVC:  Is based on Asp.Net  A framework for RAD (rapid application development), used to develop Web application  Is a composition of Model, View Controller  Is an open source and code is available at CodePlex [In 2009 – released under Microsoft Public License and in 2012 – released under Apache License 2.0]
  • 6.
    WHY MVC? Takea moment and think about a valuable Software Pattern Model-view-controller. We can also predicts from the image that MVC pattern divides a software application into a three interconnected parts/components. Basically, it’s a concept of separation (here just separation of internal representation of information from ways/logics/techniques how it is being represented to the end-user)
  • 7.
    WHY MVC? Controllercan send commands/directions to the model to update its state as well as commands over to view. Associated views and controller get notified by Model as per changes of its state. Model provides specific result as a output upon the request of View to represent.
  • 8.
    WHY MVC? Letsunderstand this from associated image In simple words, we can say that MVC is providing a facility to make our layers separate which are separated and interacting with each-other.
  • 9.
    ASP.NET MVC OVERASP.NET WEBFORMS There are numerous reasons to choose Asp.Net for web development over Asp.Net WebForms:  Asp.Net MVC is a web framework and is based on MVC pattern  No viewstate (performance is better in asp.net mvc)  Completely testable  Integration with client side (easily handshake with client side scripting like Jquery etc.)  Flexibility (provides various views engines, which renders HTML – Razor View Engine is most famous)
  • 10.
    OVERVIEW OF MODELVIEW CONTROLLER Devs we have already covered this in previous slides, lets discuss it again.
  • 11.
    OVERVIEW OF MODELVIEW CONTROLLER Conclusion - what we discussed (for asp.net mvc framework) What is a Model?  MVC model is typically a class (of C# or VB.NET).  Both controller and view can access model.  A model can be used to pass data from Controller to view  Main purpose of a view is to display data in page with the use of model.
  • 12.
    OVERVIEW OF MODELVIEW CONTROLLER Conclusion - what we discussed (for asp.net mvc framework) What is a View?  View is nothing but a page you can say a web page and it is not having any code-behind  All page specific HTML generation and formatting can be done inside view  A request to view can be made only from a controller’s action method
  • 13.
    OVERVIEW OF MODELVIEW CONTROLLER Conclusion - what we discussed (for asp.net mvc framework) What is a Controller?  Controller is typically a class (of C# or VB.Net) and inherits "system.mvc.controller"  Within this class methods can be implemented and called as action methods. These are responsible for responding to browser and/or calling views.  Controller class can access and use model class to pass data to views
  • 14.
    OVERVIEW WORKING OFMVC In this session we are not going to cover only basic things: High level overview says – browser sends request to Asp.Net MVC and it returns response back to browser [request is HTTP Request and response is HTTP response]. Lets discuss shown image:
  • 15.
    OVERVIEW WORKING OFMVC In broader way – First request comes to Route Tables then passes to specific controller before interaction with Model Binding it goes through Authentication & Authorization and afterwards Fires a specific Action Method and execute the results to View. Lets take an example to discuss more.
  • 16.
    OVERVIEW OF ROUTESCOLLECTION In simple words, routes collection (also can say Route table) is nothing but a collection of different routes. What is route? A system works on pattern matching mechanism. A route match incoming request to meet a specific pattern and allows once matched else denied. What happened at runtime? At runtime, routing engine uses route table (contains different routes) to match incoming urls with the defined route patterns (url patterns).
  • 17.
    OVERVIEW OF ROUTESCOLLECTION In above image, url will be processed if any match found else it will throw the HTTP Status code Not Found (404 error).
  • 18.
    REVISIT SESSION Inthis very first session we covered:  Basics of MVC  Discussed MVC pattern  Discussed basics of MVC architecture  Discussed basics of route collection / route table  Read here: ASP.Net MVC Series For Beginners: Part 1
  • 19.
    QUESTION/ANSWER Surely, youshould have questions, it is hard to discuss all the questions, please compile your questions and shoot me an email.
  • 20.
    FEEDBACK This isa series of sessions, today we covered very basics of asp.net mvc part. In coming session we will cover new and some advanced topics. Your feedback is very important. Provide your feedback so, I can share more worthful things with you.
  • 21.
    CONTINUES… Lets meetin next session …