22
ASP.NET MVC3 Melick Rajee Baranasooriya http://melick-rajee.blogspot.com

Mvc3 crash

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 2: Mvc3 crash

Introduction

ASP.NET MVC 3 is a framework for building

Scalable

Standards-based web applications

using well-established design patterns and

the power of ASP.NET and the .NET Framework.

Page 3: Mvc3 crash

Features

Rock Features

NuGet

Razor View Engine

HTML Helpers

Dependency Injection

Model Validation

Page 4: Mvc3 crash

Features … Improvements

Sessionless Controllers

ViewBag Property

JSON Model Binding

Granular Input Validation

Partial Page Output Cache

Global Action Filters

New Action Result Types

Page 5: Mvc3 crash

Technology Stack

Web Platform Installer 3.0

Visual Studio 2010

Express

Web Developer Express

Visual Studio 2010 SP1

MVC 3

IIS Express

[SQL Server 2008 R2 Express]

Page 6: Mvc3 crash

Model

Model

How It works

Controller Request

View Response

Model

/Customer/Add

/Customer/Add

CustomerController

Page 7: Mvc3 crash

Controllers

We are going to look

Routing

Controller Actions

Action Filters

Action Parameters

Action Results

Page 8: Mvc3 crash

Routing

http://localhost/Customer/Edit/5

Page 9: Mvc3 crash

Routing ..

Global.asmx

Page 10: Mvc3 crash

Routing ..

Accessing Routing Data

RouteData.Values["Controller"]

RouteData.Values["Action"]

RouteData.Values["Id"]);

Page 11: Mvc3 crash

Action Results

ContentResult

EmptyResult

FileResult

HttpStatusCodeResult

HttpNotFoundResult

JavaScriptResult

JsonResult

RedirectToAction

RedirectResult

RedirectToRouteResult

ViewResultBase

Many ..

Page 12: Mvc3 crash

Action Selectors Decorate Control Actions

ActionName

AcceptVerbs

GET

POST

DELETE

..

Page 13: Mvc3 crash

Action Filters

Uses to restrict the action based on filer

[Authorize(Roles="Admin")]

Page 14: Mvc3 crash

How Routing Works

Accessing Routing Data

Action Results

Action Selectors

Page 15: Mvc3 crash

Views

MVC 3 Supports

Aspx

Razor

Razor

Simple

Powerfull

Page 16: Mvc3 crash

Views ..

Strong Type View

Scaffold Template

Create

List

Details

Edit

..

Partial View

Page 17: Mvc3 crash

Views ..

Razor Syntax @

Custom Helpers

Partial Views

Page 18: Mvc3 crash

Declarative Custom Helper

Page 19: Mvc3 crash

Models

Models

Data Annotations

Model Validation

JQuery

Page 20: Mvc3 crash

JQuery

jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript.

Page 21: Mvc3 crash

Demo