SlideShare a Scribd company logo
Mvc summary
Mvc summary
What’s the Big Idea?
                 Traditional ASP.NET Web Forms 




The idea was to make web development feel just the same as Windows
Forms development.
   Traditional ASP.NET Web Forms development was a
     great idea, but reality proved more complicated. Over
     time, the use of Web Forms in real-world projects
     highlighted some shortcomings:

1- View State weight(can reach hundreds of kilobytes in even modest web applications)
2- Page life cycle (View State errors or finding that some event handlers mysteriously fail
to execute.)
3- False sense of separation of concerns(ASP.NET’s code-behind model provides a
means to take application code out of its HTML markup and into a separate codebehind
class)
4- Limited control over HTML
5- Leaky abstraction (Web Forms tries to hide away HTML and HTTP wherever possible.)
6- Low testability
1. User interaction with an MVC application follows a natural cycle: the
   user takes an action, and in response the application changes its data
   model and delivers an updated view to the user.

2. Tight Control over HTML and HTTP

3. Testability

4. Powerful Routing System

5. Built on the Best Parts of the ASP.NET Platform

6. Modern API

7. ASP.NET MVC Is Open Source
Comparisons with ASP.NET Web Forms
    ›   your choice between the two is a matter of development philosophy.
        Consider these points:
   Web Forms. This makes it suitable for drag-anddrop Windows
    Forms–style development, in which you pull UI widgets onto a
    canvas and fill in code for their event handlers.

   MVC provides a simple, powerful, modern approach to writing
    web applications, with tidy code that’s easier to extend and
    maintain over time, and that’s free of bizarre complications
    and painful limitations.
Mvc summary
The Web Platform Installer




  • Visual Studio 2010 SP1
  • SQL Server Express 2008 R2
  • ASP.NET MVC 3 Tools Update
Mvc summary
Creating a New ASP.NET MVC Project 




           The Visual Studio MVC 3 project template
Creating a New ASP.NET MVC Project 

   Selecting a type of MVC 3 project
To add a controller
to our project, right-
click the Controllers
folder in the Visual
Studio Solution
Explorer window and
choose Add and
then Controller
The output form of our controller action
                                     method




Modifying the HomeController Class
Mvc summary
Setting the Scene
  We are going to imagine that a friend has decided to host a New
  Year’s Eve party and that she has asked us to create a web site that
  allows her invitees to electronically RSVP. She has asked for four key
  features:

  •   A home page that shows information about the party
  •   A form that can be used to RSVP
  •   Validation for the RSVP form, which will display a thank-you
      page
  •   RSVPs e-mailed to the party host when complete
Mvc summary
Mvc summary
Mvc summary
A strongly typed view is intended to render a specific
domain type
Mvc summary
Visual Studio IntelliSense for lambda expressions in HTML helper methods




ASP.NET Web Forms supports only one server-side form in a web page, usually expressed
as <form runat=“server”>, which is a container for the View State data and postback
logic. MVC doesn’t use server-side forms. All forms are expressed using regular HTML, and
you can have as many of them as you like in a single view. There are no View State or
other hidden form elements, and the ID values you assign to IDs don’t get mangled.
Mvc summary
Mvc summary
Mvc summary
Mvc summary
Mvc summary
Mvc summary
<link rel="Stylesheet" href="@Href("~/Content/Site.css")" type="text/css"/>
Mvc summary
Mvc summary
    Persistence is not part of our domain model. It is an
     independent or orthogonal concern in our separation of
     concerns pattern. This means that we don’t want to mix the
     code that handles persistence with the code that defines
     the domain model.

    The usual way to enforce separation between the domain model
    and the persistence system is to define repositories.
Mvc summary
   Essential C# Features
        › Using Automatically Implemented Properties



public class Product {
  private string name;

    public string Name {
      get { return name; }
      set { name = value; }
    }
}
   Essential C# Features
     › Using Extension Methods
    Extension methods are a convenient way of adding methods to classes
    that you don’t own and so can’t modify directly.
   Essential C# Features
     › Using Lambda Expressions




                                          Using a Delegate in an Extension Method




Using a Lambda Expression to Replace a Delegate Definition
   Essential C# Features
    › Using Anonymous Types
                              Creating an Anonymous Type




                                Creating an Array of
                                Anonymously Typed Objects
   Essential C# Features
    › Performing Language Integrated Queries
Using LINQ to Query Data




Using LINQ Dot Notation
Including Multiple Functions in a Code Block
Passing Data Using the View Bag Feature
The dialog tells us to leave the layout
                                                 reference blank if it is already set in a
                                                 _viewstart file. If you look in the Views folder
                                                 in your MVC project, you will see a file
                                                 called _ViewStart.cshtml
Specifying a Razor layout when creating a
view



                              The _ViewStart.cshtml File




Note : View files that start with an underscore (_) are not returned to the user, even if
they are requested directly.
The _Layout.cshtml File




A layout is the equivalent of the ASPX master page.
Mvc summary
Using Ninject 




                  The relationships among four simple types


Our objective is to be able to create instances of ShoppingCart and inject
an implementation of the IValueCalculator class as a constructor
parameter. This is the role that Ninject, our preferred DI container, plays for
us. But before we can demonstrate Ninject, we need to get set up in Visual
Studio.
   Creating the Project
    › Adding Ninject
   Getting Started with Ninject


                     Preparing a Ninject Kernel


                                                    1



                                     Binding a Type to Ninject



                                                                 2
Mvc summary
   Getting Started
    › Creating the Visual Studio Solution and Projects
   Getting Started
    › Creating the Visual Studio Solution and Projects
       The Three SportsStore Projects
Getting Started      
               Creating the Visual Studio Solution and Projects ›




The projects shown in the
Solution Explorer window
   Starting the Domain Model

                                Creating the Product class
   Creating an Abstract Repository
    › Create a new top-level folder inside the SportsStore.Domain
      project called Abstract and a new interface called
      IProductsRepository
     The IProductRepository Interface File
   Displaying a List of Products
    › Adding a Controller
   Displaying a List of Products
    › Adding the View

               The List.cshtml View
   Displaying a List of Products
    › Setting the Default Route

      Adding the Default Route      Global.asax.cs
   Displaying a List of Products
    › Running the Application




                  Viewing the basic application functionality
   Preparing a Database
    › We are going to use SQL Server as the database, and we will access
      the database using the EntityFramework (EF), which is the .NET ORM
      framework.
       Adding Data to the Database
   Creating the Product Repository
                      EFProductRepository.cs




                      Adding the Real Repository Binding
The result of implementing the real repository   
   Adding Pagination
    › Displaying Page Links
    List.cshtml




                              the new view
                              model




                              The page links
Adding Pagination        
Displaying Page Links ›
Improving the URLs


       The new URL scheme displayed in the browser
Styling the Content




             The design goal for the SportsStore application
 Styling the Content
    Run
Creating a Partial View                 

Using a Partial View from List.cshtml
Applying a partial view   
Mvc summary
   Adding Navigation Controls
    › Filtering the Product List
        Adding Category Support to the List Action Method
   Adding Navigation Controls
    › Filtering the Product List
        http://localhost:23081/?category=Soccer


                                       Using the query string to filter by category
Adding Navigation
Controls
   Refining the URL
   Scheme

 Empty and Paging




 Category and Paging
Building a Category Navigation Menu   Implementing the Menu Metho
                                        Generating Category Lists
Building a Category Navigation Menu   
   Building the Shopping Cart




                     The basic shopping cart flow
Defining the Cart Entity
Building the Shopping Cart
        Implementing the Cart
                   Controller

We need to create a controller
     to handle the Add to cart
 button presses. Create a new
controller called CartController
The Index View
Mvc summary
   Completing the Cart
    › Removing Items from the Cart
       we are going to do by adding a Remove button in
        each row of the cart summary. The changes to
        Views/Cart/Index.cshtml
Completing the Cart 
     Removing Items from the Cart ›




Removing an item from the shopping cart
   Submitting Orders
     › Adding the Checkout Process
The shipping details form
   Submitting Orders
     › Displaying Validation Errors
        Adding a Validation Summary
    Submitting Orders
      › Displaying a Summary Page
          Right-click either of the Checkout methods in the CartController class and select
           Add View from the pop-up menu. Set the name of the view to Completed
                                             The Completed.cshtml View




    The thank-you page
Mvc summary
   Adding Catalog Management
    ›   The convention for managing collections of items is to present the user with two
        types of pages: a list page and an edit page




                      Sketch of a CRUD UI for the product catalog
   Creating a CRUD Controller
    › We want to demonstrate how to build up the controller and
       explain each step as we go. So, remove all of the methods in the
       controller

Rendering a Grid of Products in the Repository


                                                 The Index Action Method
   Creating a CRUD View
     › Creating a New Layout
        Right-click the Views/Shared folder in the SportsStore.WebUI project and select Add >
         New Item. Select the MVC 3 Layout Page (Razor) template and set the name to
         _AdminLayout.cshtml




                                                                      Creating a new Razor layout
   Creating a CRUD View
    › Implementing the List View


                                   When using the List scaffold, Visual Studio
                                   assumes you are working with an IEnumerable
                                   sequence of the model view type, so you can
                                   just select the singular form of the class from the
                                   list.
   Creating a CRUD Controller
    › Modifying the Index.cshtml
   Creating a CRUD Controller
    › Creating the Edit View
   Creating a CRUD Controller
    › Creating the Edit View
    Using Model Metadata
   Creating a CRUD Controller
    › Handling Edit POST Requests
   Creating a CRUD Controller
    › Displaying a Confirmation Message
   Creating a CRUD Controller
    › Adding Model Validation
                          Applying Validation Attributes to the Product Class
   Creating a CRUD Controller
    › Enabling Client-Side Validation
   Creating a CRUD Controller
    › Creating New Products
        First, add the Create method to the AdminController class.



This leads us to the modification. We would usually expect a form to postback to the action that
rendered it, and this is what the Html.BeginForm assumes by default when it generates an HTML
form.




Now the form will always be posted to the Edit action, regardless of which action rendered it.
   Creating a CRUD Controller
    › Creating New Products
   Creating a CRUD Controller
    › Deleting Products


                                 Adding a Method to Delete Products




                                 Implementing Deletion Support in the
                                 Entity Framework Repository Class


                                         The Delete Action Method
   Securing the Administration Features
     › Setting Up Forms Authentication
          Applying Authorization with Filters

            Adding the Authorize Attribute to the Controller
            Class




    You can apply filters to an individual action method or to a controller. When you
    apply a filter to a controller, it works as though you had applied it to every action
    method in the controller class. We applied the Authorize filter to the class, so all of
    the action methods in the Admin controller are available only to authenticated
    users.
   Securing the Administration Features
     › Setting Up Forms Authentication
        Creating the View
           Right-click in one of the action methods in the Account controller class and
           select Add View from the popup menu. Create a strongly typed view called
           LogOn that uses LogOnViewModel as the view model type




                                                                           The LogOn View
   Image Uploads
     › Updating the Entity Framework Conceptual Model
Image Uploads   
   Image Uploads
Mvc summary
Overview of MVC Projects
The initial
configuration of
MVC projects
created using the
Empty, Internet
Application, and
Intranet Application
templates
Mvc summary
Summary of MVC 3 Project Items
Mvc summary
URLs, Routing, and Areas
       Matching URLs




Table highlights two key behaviors of URL patterns:

•   URL patterns are conservative, and will match only URLs that have the same number
    of segments as the pattern. You can see this in the fourth and fifth examples in the
    table.

•   URL patterns are liberal. If a URL does have the correct number of segments, the
    pattern will extract the value for the segment variable, whatever it might be.
URLs, Routing, and Areas
Creating and Registering a Simple Route

                                           Registering a Route




A more convenient way of registering routes is to use the MapRoute
method defined in the RouteCollection class.
URLs, Routing, and Areas
Mixing Static URL Segments and Default Values




Aliasing a Controller and an Action
URLs, Routing, and Areas
Using Custom Variables as Action Method Parameters
    If we define parameters to our action method with names that match
    the URL
    pattern variables, the MVC Framework will pass the values obtained
    from the URL as parameters to the action method.




Defining Optional URL Segments




     This route will match URLs whether or not the id segment has been supplied.
URLs, Routing, and Areas
 Routing Requests for Disk Files
    We still need a way to serve content such as images, static HTML files,
    JavaScript libraries, and so on. As a demonstration, we have created a
    file called StaticContent.html in the Content folder of our example MVC
    application.




By default, the routing system checks to see if
a URL matches a disk file before evaluating
the application’s routes. If there is a match,
then the disk file is served, and the routes are
never used. We can reverse this behavior so
that our routes are evaluated before disk files
are checked by setting the RouteExistingFiles
property of the RouteCollection to true,
URLs, Routing, and Areas
Generating Outgoing URLs in Views
    The simplest way to generate an outgoing URL in a view is to call the
    Html.ActionLink method within a view
          @Html.ActionLink("About this application", "About")

                          <a href="/Home/About">About this application</a>
Targeting Other Controllers
    The default version of the ActionLink method assumes that you want to target an
    action method in the same controller that has caused the view to be rendered.
    To create an outgoing URL that targets a different controller, you can use a
    different overload that allows you to specify the controller name
       @Html.ActionLink("About this application", "About", "MyController")

                        <a href="/MyController/About">About this application</a>

 Passing Extra Values
    @Html.ActionLink("About this application", "About", new { id = "MyID" })

                   <a href="/Home/About/MyID">About this application</a>
URLs, Routing, and Areas
Generating URLs (and Not Links)
   My URL is: @Url.Action("Index", "Home", new { id = "MyId" })

        My URL is: /Home/Index/MyId


Generating Links and URLs from Routing Data
   Sometimes it is useful to treat controller and action just like any other
   variables, and to generate a link or URL by providing a collection of
   name/value pairs. We can do this by using helper methods that are not MVC-
   specific
   Generating a Link Using an Anonymous Type
   @Html.RouteLink("Routed Link", new { controller = "Home", action = "About",
   id="MyID"})

          <a href="/Home/About/MyID">Routed Link</a>

   Generating a URL Using an Anonymous Type
   @Url.RouteUrl(new { controller = "Home", action = "About", id = "MyID" })
URLs, Routing, and Areas
Working with Areas
   The MVC Framework supports organizing a web application into
   areas, where each area represents a functional segment of the
   application, such as administration, billing, customer support, and so
   on. This is useful in a large project, where having a single set of folders
   for all of the controllers, views, and models can become difficult to
   manage.
   Creating an Area
     To add an area to an MVC application, right-click the project item
     in the Solution Explorer window and select Add > Area.
URLs, Routing, and Areas
Populating an Area
  To complete this simple example, we
  can create a view by right-clicking
  inside the Index action method and
  selecting Add > View from the pop-up
  menu
Mvc summary
Controllers and Actions
Creating a Controller by Deriving from the Controller Class
 Getting
  Data from
  Context
  Objects
Controllers and Actions
 Using Action Method Parameters




 The names of our parameters are treated case-insensitively, so that an
 action method parameter called city can be populated by a value from
 Request.Form["City"].
Controllers and Actions
Specifying Default Parameter Values
  If you want to process requests that don’t contain values for action
  method parameters, but you would rather not check for null values in
  your code or have exceptions thrown, you can use the C# optional
  parameter feature instead.




 If a request does contain a value for a parameter but it cannot be
 converted to the correct type (for example, if the user gives a
 nonnumeric string for an int parameter), then the framework will pass the
 default value for that parameter type (for example, 0 for an int
 parameter), and will register the attempted value as a validation error in
 a special context object called ModelState. Unless you check for
 validation errors in ModelState, you can get into odd situations where the
 user has entered bad data into a form, but the request is processed as
 though the user had not entered any data or had entered the default
 value.
Controllers and Actions
Built-in
ActionResult
Types
Controllers and Actions
Built-in ActionResult Types
Controllers and Actions
Returning HTML by Rendering a View
Controllers and Actions
Returning HTML by Rendering a View
  When the MVC Framework calls the ExecuteResult method of the
  ViewResult object, a search will begin for the view that you have
  specified, the framework will look in the following locations:




         using areas in your project         not using areas, or you are using areas
                                             but none of the files in the preceding list
                                             have been found
Controllers and Actions
Passing Data from an Action Method to a View

   Providing a View Model Object
Controllers and Actions
Returning HTML by Rendering a View

   Passing Data with the ViewBag




The ViewBag has an advantage over using a view model object in that it is
easy to send multiple objects to the view. If we were restricted to using view
models, then we would need to create a new type that had string and
DateTime members in order to get the same effects, When working with
dynamic objects, you can enter any sequence of method and property
calls in the view, like this:
The day is: @ViewBag.Date.DayOfWeek.Blah.Blah.Blah
Controllers and Actions
Redirecting to a Literal URL




       Redirecting to a Literal URL        Permanently Redirecting to a Literal URL



Redirecting to a Routing System URL




                      Redirecting to a Routing System URL
Controllers and Actions
Returning Text Data
   You can omit the last two parameters, in which case the framework
   assumes that the data is HTML (which has the content type of text/html).
   It will try to select an encoding format that the browser has declared
   support for when it made the request you are processing. This allows you
   to return just text, like
   this:
   return Content("This is plain text");

   In fact, you can go a little further. If you return any object from an action
   method that isn’t an ActionResult, the MVC Framework will try to serialize
   the data to a string value and send it to the
Controllers and Actions
Returning XML Data
   Returning XML data from an action method is very simple, especially
   when you are using LINQ to XML and the XDocument API to generate
   XML from objects.
Controllers and Actions
Returning JSON Data
Controllers and Actions
Returning Files and Binary Data


 Sending a File
Controllers and Actions
Sending a Byte Array




Sending the Contents of a Stream
Controllers and Actions
Returning Errors and HTTP Codes
   Sending a Specific HTTP Result Code




      The constructor parameters for HttpStatusCodeResult are the numeric
      status code and an optional descriptive message. In the listing, we
      have returned code 404, which signifies that the requested resource
      doesn’t exist.
Controllers and Actions
Sending a 404 Result




Sending a 401 Result

  Another wrapper class for a specific HTTP status code is
  HttpUnauthorizedResult, which returns the 401 code, used to indicate that a
  request is unauthorized.
Controllers and Actions
The output from a custom action result
Mvc summary
Filters
Introducing the Four Basic Types of Filters
Filters
Applying Filters to Controllers and Action Methods




                                      You can apply multiple filters, and mix and
                                      match the levels at which they are applied—
                                      that is, whether they are applied to the
                                      controller or an individual action method.
Filters
Using the Built-in Filters
Filters
Using the RequireHttps Filter


  The RequireHttps filter allows you to enforce the use of the HTTPS protocol for
  actions. It redirects the user’s browser to the same action, but using the
  https:// protocol prefix.

  You can override the HandleNonHttpsRequest method to create custom
  behavior when an unsecured request is made. This filter applies to only GET
  requests. Form data values would be lost if a POST request were redirected
  in this way.
Filters
Using the OutputCache Filter

  The OutputCache filter tells the MVC Framework to cache the output from
  an action method so that the same content can be reused to service
  subsequent requests for the same URL. Caching action output can offer a
  significant increase in performance, because most of the time-consuming
  activities required to process a request (such as querying a database) are
  avoided. Of course, the downside of caching is that you are limited to
  producing the exact same response to all requests, which isn’t suitable for
  all action methods.
  The OutputCache filter uses the output caching facility from the core
  ASP.NET platform, and you will recognize the configuration options if you
  have ever used output caching in a Web Forms application.
  The OutputCache filter can be used to control client-side caching by
  affecting the values sent in the Cache-Control header.
Filters
Caching the Output of a Child Action




The controller in the listing defines two action methods:
• The ChildAction method has the OutputCache filter applied. This is the
  action method we will call from within the view.
• The Index action method will be the parent action.
Both action methods write the time that they were executed to the Response
object.
Filters
Caching the Output of a Child Action




                                           The ChildAction.cshtml View
 A View That Calls a Cached Child Action
Mvc summary
Views
Adding Dynamic Content to a Razor View
Views
Using HTML Helpers
   Creating an Inline HTML Helper
  The most direct way to create a helper is to do so in the view, using the Razor
  @helper tag
Views
Using Input Helpers
                      Basic Input HTML Helpers
Views
Using Strongly Typed Input Helpers
Views
Creating Select Elements
Views                    Creating a Sequence of Objects to Be Displayed by the
                           WebGrid Helper

Using the WebGrid Helper
Views
Using the WebGrid Helper
Views
Using the Chart Helper
Views
Using Other Built-In Helpers
Views
        Using Sections
Views
        Using Sections
Views
Using Sections
Views
Using Partial Views
Views                              A Strongly Typed Partial View



Using Strongly Typed Partial Views
Views
Using Child Actions

 Creating a Child Action
  Any action can be used as a child action.    Rendering a Child Action
    A Child Action                                 Calling a Child Action




  A Partial View for Use with a Child Action
Mvc summary
Model Templates
A View That Uses Templated HTML Helpers
Model Templates
Creating Read-Only HTML Using Templated Helpers
Model Templates
The MVC Scaffolding Templated HTML Helpers
Model Templates
Using Model Metadata
   Using Metadata to Control Editing and Visibility
       Using the HiddenInput Attribute




       Hiding model object properties from the
       user
Model Templates
Using Metadata for Data Values
Model Templates
Working with Complex Type Parameters
Model Templates
Customizing the Templated View Helper System
  Creating a Custom Editor Template
      One of the easiest ways of customizing the templated helpers is to create a
      custom template. This allows us to render exactly the HTML we want. As an
      example, we are going to create a custom template for the Role property in our
      Person class. This property is typed to be a value from the Role enumeration, but
      the way that this is rendered by default is problematic.
Model Templates
Customizing the Templated View Helper System
  Creating a Custom Editor Template
Mvc summary
Model Binding
Using the Default Model Binder
    The Order in Which the DefaultModelBinder Class Looks for Parameter Data




                              The locations are searched in order. For example, in
                              the case of the action method shown before, the
                              DefaultModelBinder class examines our action method
                              and finds that there is one parameter, called id.
Model Binding
Binding to Arrays and Collections
  One elegant feature of the default model binder is how it deals with
  multiple data items that have the same name.

   A View That Renders HTML         We have used the Html.TextBox helper to create
   Elements with the Same Name      three input elements; these will all be created with
                                    a value of movies for the name attribute




                                    Receiving Multiple Data Items in an Action Method
Model Binding
Using Model Binding to Receive File Uploads
   All we have to do to receive uploaded files is to define an action method that
   takes a parameter of the HttpPostedFileBase type. The model binder will populate
   it with the data corresponding to an uploaded file.
Mvc summary
Model Validation
    The progression of views in the sample application




Currently, our application will accept any data the user submits, but to preserve the
integrity of our application and domain model, we require three things to be true before
we accept an Appointment that the user has submitted:

•    The user must provide a name.
•    The user must provide a date (in the mm/dd/yyyy format) that is in the future.
•    The user must have checked the checkbox to accept the terms and conditions.
Model Validation
Explicitly Validating a Model




                                Errors result in highlighted elements
Model Validation
Displaying Validation Messages
Model Validation
Displaying Property-Level Validation Messages
                                       Using the per-property validation message
                                       helper




                                        Displaying model and property validation errors
Model Validation
Specifying Validation Rules Using Metadata
Model Validation
         The Built-in Validation Attributes
Model Validation
Performing Client-Side Validation
Model Validation
Performing Remote Validation




Actions methods that support remote validation must return the JsonResult type, and
the method parameter must match the name of the field being validated; in our
case, this is Date. We make sure that we can parse a DateTime object from the value
that the user has submitted and, if we can, check to see that the date is in the future
Mvc summary
Unobtrusive Ajax
 Using MVC Unobtrusive Ajax




Enabling and Disabling
Unobtrusive Ajax
                              The non-Ajax example web application
Unobtrusive Ajax
Using Unobtrusive Ajax Forms
Unobtrusive Ajax
AjaxOptions Properties
Unobtrusive Ajax
Providing the User with Feedback While Making an Ajax Request
Unobtrusive Ajax
Creating Ajax Links
Unobtrusive Ajax
Working
with Ajax
Callbacks
Unobtrusive Ajax
Processing JSON in the Browser
                                 Notice that we have not set a value
                                 for the UpdateTargetId. We can’t rely
                                 on the unobtrusive Ajax script to
                                 process the JSON data we get from
                                 the server because it is no longer
                                 HTML. Instead, we need to write a
                                 JavaScript function that will process
                                 the JSON and generate the HTML we
                                 need in the browser.
Mvc summary
Ad

More Related Content

What's hot (20)

Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
Naga Harish M
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
ivpol
 
ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines  ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines
Dev Raj Gautam
 
Mvc fundamental
Mvc fundamentalMvc fundamental
Mvc fundamental
Nguyễn Thành Phát
 
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazingMortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
Tom Walker
 
MSDN - ASP.NET MVC
MSDN - ASP.NET MVCMSDN - ASP.NET MVC
MSDN - ASP.NET MVC
Maarten Balliauw
 
ASP.NET MVC 3
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
Buu Nguyen
 
ASP .NET MVC
ASP .NET MVC ASP .NET MVC
ASP .NET MVC
eldorina
 
ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015
Hossein Zahed
 
ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)
Hatem Hamad
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
Thomas Robbins
 
ASP.NET MVC 4 Introduction
ASP.NET MVC 4 IntroductionASP.NET MVC 4 Introduction
ASP.NET MVC 4 Introduction
Lohith Goudagere Nagaraj
 
MVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVCMVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVC
Anton Krasnoshchok
 
MVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros DeveloperMVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros Developer
Nyros Technologies
 
Introduction to asp.net
Introduction to asp.netIntroduction to asp.net
Introduction to asp.net
SHADAB ALI
 
ASP .Net MVC 5
ASP .Net MVC 5ASP .Net MVC 5
ASP .Net MVC 5
Nilachal sethi
 
Introduction to asp.net
Introduction to asp.netIntroduction to asp.net
Introduction to asp.net
shan km
 
ASP.NET MVC.
ASP.NET MVC.ASP.NET MVC.
ASP.NET MVC.
Ni
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
Volkan Uzun
 
Asp 1a-aspnetmvc
Asp 1a-aspnetmvcAsp 1a-aspnetmvc
Asp 1a-aspnetmvc
Fajar Baskoro
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
ivpol
 
ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines  ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines
Dev Raj Gautam
 
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazingMortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
Tom Walker
 
ASP .NET MVC
ASP .NET MVC ASP .NET MVC
ASP .NET MVC
eldorina
 
ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015
Hossein Zahed
 
ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)
Hatem Hamad
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
Thomas Robbins
 
MVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVCMVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVC
Anton Krasnoshchok
 
MVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros DeveloperMVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros Developer
Nyros Technologies
 
Introduction to asp.net
Introduction to asp.netIntroduction to asp.net
Introduction to asp.net
SHADAB ALI
 
Introduction to asp.net
Introduction to asp.netIntroduction to asp.net
Introduction to asp.net
shan km
 
ASP.NET MVC.
ASP.NET MVC.ASP.NET MVC.
ASP.NET MVC.
Ni
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
Volkan Uzun
 

Similar to Mvc summary (20)

AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101
Rich Helton
 
Introduction-to-ASPNET-Core ASP.NET.pptx
Introduction-to-ASPNET-Core ASP.NET.pptxIntroduction-to-ASPNET-Core ASP.NET.pptx
Introduction-to-ASPNET-Core ASP.NET.pptx
MAHERMOHAMED27
 
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Sparkhound Inc.
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend Framework
Juan Antonio
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
Rasel Khan
 
Angular - Chapter 3 - Components
Angular - Chapter 3 - ComponentsAngular - Chapter 3 - Components
Angular - Chapter 3 - Components
WebStackAcademy
 
LearningMVCWithLINQToSQL
LearningMVCWithLINQToSQLLearningMVCWithLINQToSQL
LearningMVCWithLINQToSQL
Akhil Mittal
 
Building richwebapplicationsusingasp
Building richwebapplicationsusingaspBuilding richwebapplicationsusingasp
Building richwebapplicationsusingasp
Giovanni Javier Jimenez Cadena
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code Igniter
Amzad Hossain
 
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5  Building Your First Web Application (A Beginner S GuideASP.NET MVC 5  Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
Alicia Buske
 
Asp.Net MVC Intro
Asp.Net MVC IntroAsp.Net MVC Intro
Asp.Net MVC Intro
Stefano Paluello
 
Angular 9
Angular 9 Angular 9
Angular 9
Raja Vishnu
 
Enterprise Level Application Architecture with Web APIs using Entity Framewor...
Enterprise Level Application Architecture with Web APIs using Entity Framewor...Enterprise Level Application Architecture with Web APIs using Entity Framewor...
Enterprise Level Application Architecture with Web APIs using Entity Framewor...
Akhil Mittal
 
Aspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_csAspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_cs
Alfa Gama Omega
 
Entity Framework Core Cookbook 2nd Edition Ricardo Peres
Entity Framework Core Cookbook 2nd Edition Ricardo PeresEntity Framework Core Cookbook 2nd Edition Ricardo Peres
Entity Framework Core Cookbook 2nd Edition Ricardo Peres
yuvejulpah
 
No brainer
No brainerNo brainer
No brainer
Tanzim Saqib
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
Bhavin Shah
 
Mvc
MvcMvc
Mvc
Furqan Ashraf
 
codeigniter
codeignitercodeigniter
codeigniter
Utkarsh Chaturvedi
 
Beer City Code 2024 - Configurable Cloud Native Applications with .NET Aspire
Beer City Code 2024  - Configurable Cloud Native Applications with .NET AspireBeer City Code 2024  - Configurable Cloud Native Applications with .NET Aspire
Beer City Code 2024 - Configurable Cloud Native Applications with .NET Aspire
Brian McKeiver
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101
Rich Helton
 
Introduction-to-ASPNET-Core ASP.NET.pptx
Introduction-to-ASPNET-Core ASP.NET.pptxIntroduction-to-ASPNET-Core ASP.NET.pptx
Introduction-to-ASPNET-Core ASP.NET.pptx
MAHERMOHAMED27
 
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Sparkhound Inc.
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend Framework
Juan Antonio
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
Rasel Khan
 
Angular - Chapter 3 - Components
Angular - Chapter 3 - ComponentsAngular - Chapter 3 - Components
Angular - Chapter 3 - Components
WebStackAcademy
 
LearningMVCWithLINQToSQL
LearningMVCWithLINQToSQLLearningMVCWithLINQToSQL
LearningMVCWithLINQToSQL
Akhil Mittal
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code Igniter
Amzad Hossain
 
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5  Building Your First Web Application (A Beginner S GuideASP.NET MVC 5  Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
Alicia Buske
 
Enterprise Level Application Architecture with Web APIs using Entity Framewor...
Enterprise Level Application Architecture with Web APIs using Entity Framewor...Enterprise Level Application Architecture with Web APIs using Entity Framewor...
Enterprise Level Application Architecture with Web APIs using Entity Framewor...
Akhil Mittal
 
Aspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_csAspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_cs
Alfa Gama Omega
 
Entity Framework Core Cookbook 2nd Edition Ricardo Peres
Entity Framework Core Cookbook 2nd Edition Ricardo PeresEntity Framework Core Cookbook 2nd Edition Ricardo Peres
Entity Framework Core Cookbook 2nd Edition Ricardo Peres
yuvejulpah
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
Bhavin Shah
 
Beer City Code 2024 - Configurable Cloud Native Applications with .NET Aspire
Beer City Code 2024  - Configurable Cloud Native Applications with .NET AspireBeer City Code 2024  - Configurable Cloud Native Applications with .NET Aspire
Beer City Code 2024 - Configurable Cloud Native Applications with .NET Aspire
Brian McKeiver
 
Ad

More from Muhammad Younis (11)

Object Oriented Programming C#
Object Oriented Programming C#Object Oriented Programming C#
Object Oriented Programming C#
Muhammad Younis
 
Linq to sql
Linq to sqlLinq to sql
Linq to sql
Muhammad Younis
 
Google maps api 3
Google maps api 3Google maps api 3
Google maps api 3
Muhammad Younis
 
Microsoft reports
Microsoft reportsMicrosoft reports
Microsoft reports
Muhammad Younis
 
Stored procedures
Stored proceduresStored procedures
Stored procedures
Muhammad Younis
 
Mvc4
Mvc4Mvc4
Mvc4
Muhammad Younis
 
Mvc webforms
Mvc webformsMvc webforms
Mvc webforms
Muhammad Younis
 
Share point overview
Share point overviewShare point overview
Share point overview
Muhammad Younis
 
Lightswitch
LightswitchLightswitch
Lightswitch
Muhammad Younis
 
Mvc3 part2
Mvc3   part2Mvc3   part2
Mvc3 part2
Muhammad Younis
 
Mvc3 part1
Mvc3   part1Mvc3   part1
Mvc3 part1
Muhammad Younis
 
Ad

Recently uploaded (20)

Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
Unit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theoriesUnit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theories
bharath321164
 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd year
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd yearVitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd year
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd year
ARUN KUMAR
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Diabetic neuropathy peripheral autonomic
Diabetic neuropathy peripheral autonomicDiabetic neuropathy peripheral autonomic
Diabetic neuropathy peripheral autonomic
Pankaj Patawari
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
High Performance Liquid Chromatography .pptx
High Performance Liquid Chromatography .pptxHigh Performance Liquid Chromatography .pptx
High Performance Liquid Chromatography .pptx
Ayush Srivastava
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
Unit 4: Long term- Capital budgeting and its types
Unit 4: Long term- Capital budgeting and its typesUnit 4: Long term- Capital budgeting and its types
Unit 4: Long term- Capital budgeting and its types
bharath321164
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
Unit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theoriesUnit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theories
bharath321164
 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd year
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd yearVitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd year
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd year
ARUN KUMAR
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Diabetic neuropathy peripheral autonomic
Diabetic neuropathy peripheral autonomicDiabetic neuropathy peripheral autonomic
Diabetic neuropathy peripheral autonomic
Pankaj Patawari
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
High Performance Liquid Chromatography .pptx
High Performance Liquid Chromatography .pptxHigh Performance Liquid Chromatography .pptx
High Performance Liquid Chromatography .pptx
Ayush Srivastava
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
Unit 4: Long term- Capital budgeting and its types
Unit 4: Long term- Capital budgeting and its typesUnit 4: Long term- Capital budgeting and its types
Unit 4: Long term- Capital budgeting and its types
bharath321164
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 

Mvc summary

  • 3. What’s the Big Idea? Traditional ASP.NET Web Forms  The idea was to make web development feel just the same as Windows Forms development.
  • 4. Traditional ASP.NET Web Forms development was a great idea, but reality proved more complicated. Over time, the use of Web Forms in real-world projects highlighted some shortcomings: 1- View State weight(can reach hundreds of kilobytes in even modest web applications) 2- Page life cycle (View State errors or finding that some event handlers mysteriously fail to execute.) 3- False sense of separation of concerns(ASP.NET’s code-behind model provides a means to take application code out of its HTML markup and into a separate codebehind class) 4- Limited control over HTML 5- Leaky abstraction (Web Forms tries to hide away HTML and HTTP wherever possible.) 6- Low testability
  • 5. 1. User interaction with an MVC application follows a natural cycle: the user takes an action, and in response the application changes its data model and delivers an updated view to the user. 2. Tight Control over HTML and HTTP 3. Testability 4. Powerful Routing System 5. Built on the Best Parts of the ASP.NET Platform 6. Modern API 7. ASP.NET MVC Is Open Source
  • 6. Comparisons with ASP.NET Web Forms › your choice between the two is a matter of development philosophy. Consider these points:  Web Forms. This makes it suitable for drag-anddrop Windows Forms–style development, in which you pull UI widgets onto a canvas and fill in code for their event handlers.  MVC provides a simple, powerful, modern approach to writing web applications, with tidy code that’s easier to extend and maintain over time, and that’s free of bizarre complications and painful limitations.
  • 8. The Web Platform Installer • Visual Studio 2010 SP1 • SQL Server Express 2008 R2 • ASP.NET MVC 3 Tools Update
  • 10. Creating a New ASP.NET MVC Project  The Visual Studio MVC 3 project template
  • 11. Creating a New ASP.NET MVC Project  Selecting a type of MVC 3 project
  • 12. To add a controller to our project, right- click the Controllers folder in the Visual Studio Solution Explorer window and choose Add and then Controller
  • 13. The output form of our controller action method Modifying the HomeController Class
  • 15. Setting the Scene We are going to imagine that a friend has decided to host a New Year’s Eve party and that she has asked us to create a web site that allows her invitees to electronically RSVP. She has asked for four key features: • A home page that shows information about the party • A form that can be used to RSVP • Validation for the RSVP form, which will display a thank-you page • RSVPs e-mailed to the party host when complete
  • 19. A strongly typed view is intended to render a specific domain type
  • 21. Visual Studio IntelliSense for lambda expressions in HTML helper methods ASP.NET Web Forms supports only one server-side form in a web page, usually expressed as <form runat=“server”>, which is a container for the View State data and postback logic. MVC doesn’t use server-side forms. All forms are expressed using regular HTML, and you can have as many of them as you like in a single view. There are no View State or other hidden form elements, and the ID values you assign to IDs don’t get mangled.
  • 31. Persistence is not part of our domain model. It is an independent or orthogonal concern in our separation of concerns pattern. This means that we don’t want to mix the code that handles persistence with the code that defines the domain model. The usual way to enforce separation between the domain model and the persistence system is to define repositories.
  • 33. Essential C# Features › Using Automatically Implemented Properties public class Product { private string name; public string Name { get { return name; } set { name = value; } } }
  • 34. Essential C# Features › Using Extension Methods Extension methods are a convenient way of adding methods to classes that you don’t own and so can’t modify directly.
  • 35. Essential C# Features › Using Lambda Expressions Using a Delegate in an Extension Method Using a Lambda Expression to Replace a Delegate Definition
  • 36. Essential C# Features › Using Anonymous Types Creating an Anonymous Type Creating an Array of Anonymously Typed Objects
  • 37. Essential C# Features › Performing Language Integrated Queries Using LINQ to Query Data Using LINQ Dot Notation
  • 38. Including Multiple Functions in a Code Block
  • 39. Passing Data Using the View Bag Feature
  • 40. The dialog tells us to leave the layout reference blank if it is already set in a _viewstart file. If you look in the Views folder in your MVC project, you will see a file called _ViewStart.cshtml Specifying a Razor layout when creating a view The _ViewStart.cshtml File Note : View files that start with an underscore (_) are not returned to the user, even if they are requested directly.
  • 41. The _Layout.cshtml File A layout is the equivalent of the ASPX master page.
  • 43. Using Ninject  The relationships among four simple types Our objective is to be able to create instances of ShoppingCart and inject an implementation of the IValueCalculator class as a constructor parameter. This is the role that Ninject, our preferred DI container, plays for us. But before we can demonstrate Ninject, we need to get set up in Visual Studio.
  • 44. Creating the Project › Adding Ninject
  • 45. Getting Started with Ninject Preparing a Ninject Kernel 1 Binding a Type to Ninject 2
  • 47. Getting Started › Creating the Visual Studio Solution and Projects
  • 48. Getting Started › Creating the Visual Studio Solution and Projects  The Three SportsStore Projects
  • 49. Getting Started  Creating the Visual Studio Solution and Projects › The projects shown in the Solution Explorer window
  • 50. Starting the Domain Model Creating the Product class
  • 51. Creating an Abstract Repository › Create a new top-level folder inside the SportsStore.Domain project called Abstract and a new interface called IProductsRepository The IProductRepository Interface File
  • 52. Displaying a List of Products › Adding a Controller
  • 53. Displaying a List of Products › Adding the View The List.cshtml View
  • 54. Displaying a List of Products › Setting the Default Route Adding the Default Route Global.asax.cs
  • 55. Displaying a List of Products › Running the Application Viewing the basic application functionality
  • 56. Preparing a Database › We are going to use SQL Server as the database, and we will access the database using the EntityFramework (EF), which is the .NET ORM framework.  Adding Data to the Database
  • 57. Creating the Product Repository EFProductRepository.cs Adding the Real Repository Binding
  • 58. The result of implementing the real repository 
  • 59. Adding Pagination › Displaying Page Links List.cshtml the new view model The page links
  • 60. Adding Pagination  Displaying Page Links ›
  • 61. Improving the URLs The new URL scheme displayed in the browser
  • 62. Styling the Content The design goal for the SportsStore application
  • 63.  Styling the Content  Run
  • 64. Creating a Partial View  Using a Partial View from List.cshtml
  • 65. Applying a partial view 
  • 67. Adding Navigation Controls › Filtering the Product List  Adding Category Support to the List Action Method
  • 68. Adding Navigation Controls › Filtering the Product List  http://localhost:23081/?category=Soccer Using the query string to filter by category
  • 69. Adding Navigation Controls Refining the URL Scheme Empty and Paging Category and Paging
  • 70. Building a Category Navigation Menu Implementing the Menu Metho Generating Category Lists
  • 71. Building a Category Navigation Menu 
  • 72. Building the Shopping Cart The basic shopping cart flow
  • 74. Building the Shopping Cart Implementing the Cart Controller We need to create a controller to handle the Add to cart button presses. Create a new controller called CartController
  • 77. Completing the Cart › Removing Items from the Cart  we are going to do by adding a Remove button in each row of the cart summary. The changes to Views/Cart/Index.cshtml
  • 78. Completing the Cart  Removing Items from the Cart › Removing an item from the shopping cart
  • 79. Submitting Orders › Adding the Checkout Process
  • 81. Submitting Orders › Displaying Validation Errors  Adding a Validation Summary
  • 82. Submitting Orders › Displaying a Summary Page  Right-click either of the Checkout methods in the CartController class and select Add View from the pop-up menu. Set the name of the view to Completed The Completed.cshtml View The thank-you page
  • 84. Adding Catalog Management › The convention for managing collections of items is to present the user with two types of pages: a list page and an edit page Sketch of a CRUD UI for the product catalog
  • 85. Creating a CRUD Controller › We want to demonstrate how to build up the controller and explain each step as we go. So, remove all of the methods in the controller Rendering a Grid of Products in the Repository The Index Action Method
  • 86. Creating a CRUD View › Creating a New Layout  Right-click the Views/Shared folder in the SportsStore.WebUI project and select Add > New Item. Select the MVC 3 Layout Page (Razor) template and set the name to _AdminLayout.cshtml Creating a new Razor layout
  • 87. Creating a CRUD View › Implementing the List View When using the List scaffold, Visual Studio assumes you are working with an IEnumerable sequence of the model view type, so you can just select the singular form of the class from the list.
  • 88. Creating a CRUD Controller › Modifying the Index.cshtml
  • 89. Creating a CRUD Controller › Creating the Edit View
  • 90. Creating a CRUD Controller › Creating the Edit View Using Model Metadata
  • 91. Creating a CRUD Controller › Handling Edit POST Requests
  • 92. Creating a CRUD Controller › Displaying a Confirmation Message
  • 93. Creating a CRUD Controller › Adding Model Validation Applying Validation Attributes to the Product Class
  • 94. Creating a CRUD Controller › Enabling Client-Side Validation
  • 95. Creating a CRUD Controller › Creating New Products  First, add the Create method to the AdminController class. This leads us to the modification. We would usually expect a form to postback to the action that rendered it, and this is what the Html.BeginForm assumes by default when it generates an HTML form. Now the form will always be posted to the Edit action, regardless of which action rendered it.
  • 96. Creating a CRUD Controller › Creating New Products
  • 97. Creating a CRUD Controller › Deleting Products Adding a Method to Delete Products Implementing Deletion Support in the Entity Framework Repository Class The Delete Action Method
  • 98. Securing the Administration Features › Setting Up Forms Authentication  Applying Authorization with Filters Adding the Authorize Attribute to the Controller Class You can apply filters to an individual action method or to a controller. When you apply a filter to a controller, it works as though you had applied it to every action method in the controller class. We applied the Authorize filter to the class, so all of the action methods in the Admin controller are available only to authenticated users.
  • 99. Securing the Administration Features › Setting Up Forms Authentication  Creating the View Right-click in one of the action methods in the Account controller class and select Add View from the popup menu. Create a strongly typed view called LogOn that uses LogOnViewModel as the view model type The LogOn View
  • 100. Image Uploads › Updating the Entity Framework Conceptual Model
  • 102. Image Uploads
  • 104. Overview of MVC Projects The initial configuration of MVC projects created using the Empty, Internet Application, and Intranet Application templates
  • 106. Summary of MVC 3 Project Items
  • 108. URLs, Routing, and Areas Matching URLs Table highlights two key behaviors of URL patterns: • URL patterns are conservative, and will match only URLs that have the same number of segments as the pattern. You can see this in the fourth and fifth examples in the table. • URL patterns are liberal. If a URL does have the correct number of segments, the pattern will extract the value for the segment variable, whatever it might be.
  • 109. URLs, Routing, and Areas Creating and Registering a Simple Route Registering a Route A more convenient way of registering routes is to use the MapRoute method defined in the RouteCollection class.
  • 110. URLs, Routing, and Areas Mixing Static URL Segments and Default Values Aliasing a Controller and an Action
  • 111. URLs, Routing, and Areas Using Custom Variables as Action Method Parameters If we define parameters to our action method with names that match the URL pattern variables, the MVC Framework will pass the values obtained from the URL as parameters to the action method. Defining Optional URL Segments This route will match URLs whether or not the id segment has been supplied.
  • 112. URLs, Routing, and Areas Routing Requests for Disk Files We still need a way to serve content such as images, static HTML files, JavaScript libraries, and so on. As a demonstration, we have created a file called StaticContent.html in the Content folder of our example MVC application. By default, the routing system checks to see if a URL matches a disk file before evaluating the application’s routes. If there is a match, then the disk file is served, and the routes are never used. We can reverse this behavior so that our routes are evaluated before disk files are checked by setting the RouteExistingFiles property of the RouteCollection to true,
  • 113. URLs, Routing, and Areas Generating Outgoing URLs in Views The simplest way to generate an outgoing URL in a view is to call the Html.ActionLink method within a view @Html.ActionLink("About this application", "About") <a href="/Home/About">About this application</a> Targeting Other Controllers The default version of the ActionLink method assumes that you want to target an action method in the same controller that has caused the view to be rendered. To create an outgoing URL that targets a different controller, you can use a different overload that allows you to specify the controller name @Html.ActionLink("About this application", "About", "MyController") <a href="/MyController/About">About this application</a> Passing Extra Values @Html.ActionLink("About this application", "About", new { id = "MyID" }) <a href="/Home/About/MyID">About this application</a>
  • 114. URLs, Routing, and Areas Generating URLs (and Not Links) My URL is: @Url.Action("Index", "Home", new { id = "MyId" }) My URL is: /Home/Index/MyId Generating Links and URLs from Routing Data Sometimes it is useful to treat controller and action just like any other variables, and to generate a link or URL by providing a collection of name/value pairs. We can do this by using helper methods that are not MVC- specific Generating a Link Using an Anonymous Type @Html.RouteLink("Routed Link", new { controller = "Home", action = "About", id="MyID"}) <a href="/Home/About/MyID">Routed Link</a> Generating a URL Using an Anonymous Type @Url.RouteUrl(new { controller = "Home", action = "About", id = "MyID" })
  • 115. URLs, Routing, and Areas Working with Areas The MVC Framework supports organizing a web application into areas, where each area represents a functional segment of the application, such as administration, billing, customer support, and so on. This is useful in a large project, where having a single set of folders for all of the controllers, views, and models can become difficult to manage. Creating an Area To add an area to an MVC application, right-click the project item in the Solution Explorer window and select Add > Area.
  • 116. URLs, Routing, and Areas Populating an Area To complete this simple example, we can create a view by right-clicking inside the Index action method and selecting Add > View from the pop-up menu
  • 118. Controllers and Actions Creating a Controller by Deriving from the Controller Class
  • 119.  Getting Data from Context Objects
  • 120. Controllers and Actions  Using Action Method Parameters The names of our parameters are treated case-insensitively, so that an action method parameter called city can be populated by a value from Request.Form["City"].
  • 121. Controllers and Actions Specifying Default Parameter Values If you want to process requests that don’t contain values for action method parameters, but you would rather not check for null values in your code or have exceptions thrown, you can use the C# optional parameter feature instead. If a request does contain a value for a parameter but it cannot be converted to the correct type (for example, if the user gives a nonnumeric string for an int parameter), then the framework will pass the default value for that parameter type (for example, 0 for an int parameter), and will register the attempted value as a validation error in a special context object called ModelState. Unless you check for validation errors in ModelState, you can get into odd situations where the user has entered bad data into a form, but the request is processed as though the user had not entered any data or had entered the default value.
  • 123. Controllers and Actions Built-in ActionResult Types
  • 124. Controllers and Actions Returning HTML by Rendering a View
  • 125. Controllers and Actions Returning HTML by Rendering a View When the MVC Framework calls the ExecuteResult method of the ViewResult object, a search will begin for the view that you have specified, the framework will look in the following locations: using areas in your project not using areas, or you are using areas but none of the files in the preceding list have been found
  • 126. Controllers and Actions Passing Data from an Action Method to a View Providing a View Model Object
  • 127. Controllers and Actions Returning HTML by Rendering a View Passing Data with the ViewBag The ViewBag has an advantage over using a view model object in that it is easy to send multiple objects to the view. If we were restricted to using view models, then we would need to create a new type that had string and DateTime members in order to get the same effects, When working with dynamic objects, you can enter any sequence of method and property calls in the view, like this: The day is: @ViewBag.Date.DayOfWeek.Blah.Blah.Blah
  • 128. Controllers and Actions Redirecting to a Literal URL Redirecting to a Literal URL Permanently Redirecting to a Literal URL Redirecting to a Routing System URL Redirecting to a Routing System URL
  • 129. Controllers and Actions Returning Text Data You can omit the last two parameters, in which case the framework assumes that the data is HTML (which has the content type of text/html). It will try to select an encoding format that the browser has declared support for when it made the request you are processing. This allows you to return just text, like this: return Content("This is plain text"); In fact, you can go a little further. If you return any object from an action method that isn’t an ActionResult, the MVC Framework will try to serialize the data to a string value and send it to the
  • 130. Controllers and Actions Returning XML Data Returning XML data from an action method is very simple, especially when you are using LINQ to XML and the XDocument API to generate XML from objects.
  • 132. Controllers and Actions Returning Files and Binary Data Sending a File
  • 133. Controllers and Actions Sending a Byte Array Sending the Contents of a Stream
  • 134. Controllers and Actions Returning Errors and HTTP Codes Sending a Specific HTTP Result Code The constructor parameters for HttpStatusCodeResult are the numeric status code and an optional descriptive message. In the listing, we have returned code 404, which signifies that the requested resource doesn’t exist.
  • 135. Controllers and Actions Sending a 404 Result Sending a 401 Result Another wrapper class for a specific HTTP status code is HttpUnauthorizedResult, which returns the 401 code, used to indicate that a request is unauthorized.
  • 136. Controllers and Actions The output from a custom action result
  • 138. Filters Introducing the Four Basic Types of Filters
  • 139. Filters Applying Filters to Controllers and Action Methods You can apply multiple filters, and mix and match the levels at which they are applied— that is, whether they are applied to the controller or an individual action method.
  • 141. Filters Using the RequireHttps Filter The RequireHttps filter allows you to enforce the use of the HTTPS protocol for actions. It redirects the user’s browser to the same action, but using the https:// protocol prefix. You can override the HandleNonHttpsRequest method to create custom behavior when an unsecured request is made. This filter applies to only GET requests. Form data values would be lost if a POST request were redirected in this way.
  • 142. Filters Using the OutputCache Filter The OutputCache filter tells the MVC Framework to cache the output from an action method so that the same content can be reused to service subsequent requests for the same URL. Caching action output can offer a significant increase in performance, because most of the time-consuming activities required to process a request (such as querying a database) are avoided. Of course, the downside of caching is that you are limited to producing the exact same response to all requests, which isn’t suitable for all action methods. The OutputCache filter uses the output caching facility from the core ASP.NET platform, and you will recognize the configuration options if you have ever used output caching in a Web Forms application. The OutputCache filter can be used to control client-side caching by affecting the values sent in the Cache-Control header.
  • 143. Filters Caching the Output of a Child Action The controller in the listing defines two action methods: • The ChildAction method has the OutputCache filter applied. This is the action method we will call from within the view. • The Index action method will be the parent action. Both action methods write the time that they were executed to the Response object.
  • 144. Filters Caching the Output of a Child Action The ChildAction.cshtml View A View That Calls a Cached Child Action
  • 146. Views Adding Dynamic Content to a Razor View
  • 147. Views Using HTML Helpers Creating an Inline HTML Helper The most direct way to create a helper is to do so in the view, using the Razor @helper tag
  • 148. Views Using Input Helpers Basic Input HTML Helpers
  • 149. Views Using Strongly Typed Input Helpers
  • 151. Views Creating a Sequence of Objects to Be Displayed by the WebGrid Helper Using the WebGrid Helper
  • 155. Views Using Sections
  • 156. Views Using Sections
  • 159. Views A Strongly Typed Partial View Using Strongly Typed Partial Views
  • 160. Views Using Child Actions Creating a Child Action Any action can be used as a child action. Rendering a Child Action A Child Action Calling a Child Action A Partial View for Use with a Child Action
  • 162. Model Templates A View That Uses Templated HTML Helpers
  • 163. Model Templates Creating Read-Only HTML Using Templated Helpers
  • 164. Model Templates The MVC Scaffolding Templated HTML Helpers
  • 165. Model Templates Using Model Metadata Using Metadata to Control Editing and Visibility Using the HiddenInput Attribute Hiding model object properties from the user
  • 166. Model Templates Using Metadata for Data Values
  • 167. Model Templates Working with Complex Type Parameters
  • 168. Model Templates Customizing the Templated View Helper System Creating a Custom Editor Template One of the easiest ways of customizing the templated helpers is to create a custom template. This allows us to render exactly the HTML we want. As an example, we are going to create a custom template for the Role property in our Person class. This property is typed to be a value from the Role enumeration, but the way that this is rendered by default is problematic.
  • 169. Model Templates Customizing the Templated View Helper System Creating a Custom Editor Template
  • 171. Model Binding Using the Default Model Binder The Order in Which the DefaultModelBinder Class Looks for Parameter Data The locations are searched in order. For example, in the case of the action method shown before, the DefaultModelBinder class examines our action method and finds that there is one parameter, called id.
  • 172. Model Binding Binding to Arrays and Collections One elegant feature of the default model binder is how it deals with multiple data items that have the same name. A View That Renders HTML We have used the Html.TextBox helper to create Elements with the Same Name three input elements; these will all be created with a value of movies for the name attribute Receiving Multiple Data Items in an Action Method
  • 173. Model Binding Using Model Binding to Receive File Uploads All we have to do to receive uploaded files is to define an action method that takes a parameter of the HttpPostedFileBase type. The model binder will populate it with the data corresponding to an uploaded file.
  • 175. Model Validation The progression of views in the sample application Currently, our application will accept any data the user submits, but to preserve the integrity of our application and domain model, we require three things to be true before we accept an Appointment that the user has submitted: • The user must provide a name. • The user must provide a date (in the mm/dd/yyyy format) that is in the future. • The user must have checked the checkbox to accept the terms and conditions.
  • 176. Model Validation Explicitly Validating a Model Errors result in highlighted elements
  • 178. Model Validation Displaying Property-Level Validation Messages Using the per-property validation message helper Displaying model and property validation errors
  • 179. Model Validation Specifying Validation Rules Using Metadata
  • 180. Model Validation The Built-in Validation Attributes
  • 182. Model Validation Performing Remote Validation Actions methods that support remote validation must return the JsonResult type, and the method parameter must match the name of the field being validated; in our case, this is Date. We make sure that we can parse a DateTime object from the value that the user has submitted and, if we can, check to see that the date is in the future
  • 184. Unobtrusive Ajax Using MVC Unobtrusive Ajax Enabling and Disabling Unobtrusive Ajax The non-Ajax example web application
  • 187. Unobtrusive Ajax Providing the User with Feedback While Making an Ajax Request
  • 190. Unobtrusive Ajax Processing JSON in the Browser Notice that we have not set a value for the UpdateTargetId. We can’t rely on the unobtrusive Ajax script to process the JSON data we get from the server because it is no longer HTML. Instead, we need to write a JavaScript function that will process the JSON and generate the HTML we need in the browser.