ASP.NET MVC 5 Intro.pdf

Embed Size (px)

Citation preview

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    1/35

    IntroducingASP.NET MVC 5

    - Day 1

    By

    I. Sekhar Sriniva

    Email Id :sekharonline4u@

    Facebook :http://facebook.c

    YouTube :

    http://youtube.co

    Website:

    www.sekharthegu

    mailto:[email protected]://facebook.com/sekharonlinehttp://facebook.com/sekharonlinemailto:[email protected]
  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    2/35

    Agenda

    Introduction to ASP.NET MVC Getting Started

    Creating an Application in ASP.NET MVC

    Working with Controllers in ASP.NET MVC

    Understanding Razor View Engine

    Understanding Bootstrap 3 usage in MVC

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    3/35

    Why Should We Care About?

    Build on ASP.NET

    Scalable

    Extensible

    Testable

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    4/35

    History of MVC

    Introduced by TrygveReenskaug in 1979. First used in SmallTalk 80.

    MVC is also used by:

    Java: Structs, Spring

    PHP: Cake PHP

    Python: Django Ruby: Ruby on Rails

    Perl: Catalyst

    .NET: ASP.NET MVC

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    5/35

    History of ASP.NET MVC Cont.

    1.0

    ( 2009 )

    2.0

    ( 2010 )

    3.0

    ( 2011 )

    4.0

    ( 2012 )

    MVC Essentials

    Models , Viewsand Controllers

    URL Routing

    HTML Helpers

    Model Binding

    Model LevelValidations using

    Validation

    Attributes

    Lambda

    Expressions in

    HTML Helpers

    Razor Engine

    View Remote

    Validations

    Global Action

    Filters

    Dependency

    Resolvers

    Project Templates

    Web API Bundles and

    Minification

    Jquery Mobile

    Integration

    Open

    Authentications

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    6/35

    What MVC is Not?

    Not the new Web Forms 4.0 Not a replacement for Web Forms, but Adds to it

    It can not use Web Controls

    Not a whole new engine but sits on ASP.NET engine

    Not the best solution for REST

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    7/35

    What is ASP.NET MVC ?

    A new Web Application Project type Simply an option

    Not a replacement for WebForms

    Builds on top ASP.NET

    Manual vs Automatic Transmission

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    8/35

    What ASP.NET MVC is?

    Maintain Clean Separation of Concerns

    Extensible and Pluggable

    Enable clean URLs and HTML

    Great integration within ASP.NET

    Tooling Support

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    9/35

    Tools to Use Setting Environment

    VS.NET 2013: ASP.NET MVC 4 and ASP.NET MVC 5 are built-i

    VS.NET 2012: ASP.NET MVC 3 and ASP.NET MVC 4 are built-i

    VS.NET 2010 SP1: ASP.NET MVC 2 is built-in

    To use MVC3:

    Install "ASP.NETMVC3RTM

    To use MVC4:

    Install "ASP.NETMVC4forVisualStudio2010SP1"

    http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=4211http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=4211http://www.microsoft.com/en-in/download/details.aspx?id=30683http://www.microsoft.com/en-in/download/details.aspx?id=30683http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=4211
  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    10/35

    New Features of ASP.NET MVC 5

    Sites Ser

    SinglePage

    Apps

    MVC Web APIWeb PagesWeb Forms

    ASP.NET

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    11/35

    Introducing ASP.NET MVC

    MVC is an Architectural Pattern which separates an application into 3 main compon

    Model

    View Controller

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    12/35

    ASP.NET MVC Flow

    Request

    Controller

    Step 1

    Incoming request directed to Controller

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    13/35

    ASP.NET MVC Flow

    Controller

    Model

    Step 2Controller processes request and forms a data Model

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    14/35

    ASP.NET MVC Flow

    Controller

    ViewStep 3

    Model is passed to View

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    15/35

    ASP.NET MVC Flow

    Controller

    View

    Step 4

    View transforms Model into appropriate output for

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    16/35

    ASP.NET MVC Flow

    Response

    Controller

    View

    Step 5

    Response is rendered

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    17/35

    Thread Pool

    Requests

    Busy Busy Busy Busy

    SlowSlowSlow Slo

    Traditional Web Application Developm

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    18/35

    Thread Pool

    Requests

    Slow

    Async. Programming in ASP.NET MV

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    19/35

    To MVC or not To MVC, Thats the

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    20/35

    Understanding Controllers

    It is a class which is used to accept the request from the useprovide the response to the user.

    ControllersAction

    Action

    Results

    Action

    Parameters

    Action

    Filters

    Routing

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    21/35

    Controllers Actions

    Actions are the ultimate request destination Public controlmethods

    Non-static

    No return value restrictions

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    22/35

    Action Parameters

    Actions can take a variety of parameters Primitive parametbool, string)

    Complex parameters

    Model Binder looks for parameter values In route data

    In form data

    In query string

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    23/35

    Results Actions typically return an ActionResult

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    24/35

    Action Selectors

    ActionName

    AcceptVerbs HttpPost, HttpGet

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    25/35

    Action Filters

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    26/35

    Custom Action Filters

    Derive from ActionFilterAttribute base class

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    27/35

    ASP.NET MVC Request Flow

    Request

    HTTPRouting

    RouteRoute

    Handler

    HttpHandler

    Controller

    ViewEngine

    View

    Response

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    28/35

    Demos

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    29/35

    Different Sizes !

    Different Resolutions !

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    30/35

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    31/35

    Devices supported by Bootstrap

    Extremely Small

    Devices

    Phones(

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    32/35

    What is Bootstrap 3 Grid System ?

    1 2 3 4 5 6 7 8 9 10 11 1

    Col-md-12

    Col-md-12

    Col-md-6

    Col-md-6 Col-md-6

    Col-md-8

    Col-md-8

    Col-md-4

    Col-md-4

    col-md-3 col-md-offset-3

    col-md-3

    col-md-offset-3

    col-md-3 col-md-offset-1

    col-md-3

    col-md-offset-1

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    33/35

    Bootstrap Grid Mobile Tablet and De

    Col-xs-X Col-sm-X Col-md-X

    1 2 3 4 5 6 7 8 9 10 11 1

    Col-md-8 col-sm-6 col-xs-12 Col-md-4 col-xs-6

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    34/35

    Demos

  • 7/25/2019 ASP.NET MVC 5 Intro.pdf

    35/35

    Questions?

    By

    Sekhar Srinivasan ( MCT )

    Email Id :[email protected]

    Facebook :

    http://facebook.com/sekharonline

    YouTube :

    http://youtube.com/sekharonline4u

    Website:

    www.sekhartheguru.net

    mailto:[email protected]://facebook.com/sekharonlinehttp://facebook.com/sekharonlinemailto:[email protected]