SlideShare ist ein Scribd-Unternehmen logo
1 von 9
BUILD YOUR WEB APPLICATION WITH ASP.NET MVC 2 FROM SCRATCH ZZ Black Coffee #5 : Web Programming ChalermponAreepong : Nine (นาย) Greatfriends community lead Microsoft MVP : ASP.NET
Agenda Demo Fast build web mvc application  Routing Control Model View Unit Testing Extend MVC 2 DI/ Ajax/ Telirik MVC UI Question / Answer
Demo Fast build web mvc application
Routing Responsibility Map request to controller action Create out going Url corresponds with controller action Route Pattern Default parameter value routes.aMapRoute(“simple”, “{controller}/{action}/{id}”, new {id=“”}); Constraints with Regular Expression Cacheable - Data parameter
Controller Action Method {action}  =  controller method Parameter {controller}/{action}/{id}  {id} = parameter for controller method Multi parameter {controller}/{action}/{id},{name} routes.MapRoute(“hello,”say/hello/{id},{name}”, new { Controller = “say”, action = “hello”}); Default parameter  test([DefaultValue(10)]int max) {…} C#4 test(int max = 10) {…}
Controller (2) ActionResult is abstract class for return action result type ViewResult, RedirectResult, JsonResult, etc. Accept Verb [HttpGet] ActionResult Edit(string id){…} [HttpPost]  ActionResult Edit(string id, FormCollection form) {…} Asynchronous Controller
VIew Strong Typed Views public partial class Index : ViewPage<Product> {…} Controller  : return View(product); ViewModel custom class to render view by requirement Html Helper class ViewEngine
Model ViewModel Input Report DomainModel Business Object Business Rule Business Method Data Access ORM Repository Pattern
Extend mvc AJAX Required MicrosoftAjax.js, MicrosoftMvcAjax.js Sample code  view <%: Using(Ajax.BeginForm(“HelloAjax”, new AjaxOptions { UpdateTargetId = “results”})) {  %> <%: Html.Textbox(“query”, null, new {size=40}) %>  <input type=“submit /> <% } %> <div id=“results”> </div> Sample code controller public ActionResultHelloAjax(string query)  {  if(Request.IsAjaxRequest()) { return Content(“You entered” + query);} else { return RedirectToAction(“Index”, new {query = query}); } }

Weitere ähnliche Inhalte

Was ist angesagt?

Samza sql stream processing meetup
Samza sql stream processing meetupSamza sql stream processing meetup
Samza sql stream processing meetupSrinivasulu Punuru
 
Asp.net mvc basic introduction
Asp.net mvc basic introductionAsp.net mvc basic introduction
Asp.net mvc basic introductionBhagath Gopinath
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVCSunpawet Somsin
 
Baking With Cake Php
Baking With Cake PhpBaking With Cake Php
Baking With Cake Phpvalberg
 
2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca
2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca
2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge LucaaOS Community
 
Membangun Moderen UI dengan Vue.js
Membangun Moderen UI dengan Vue.jsMembangun Moderen UI dengan Vue.js
Membangun Moderen UI dengan Vue.jsFroyo Framework
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentationBhavin Shah
 
Ember.js for Big Profit
Ember.js for Big ProfitEmber.js for Big Profit
Ember.js for Big ProfitCodeCore
 
ASP .NET MVC
ASP .NET MVC ASP .NET MVC
ASP .NET MVC eldorina
 
Angular.js - An introduction for the unitiated
Angular.js - An introduction for the unitiatedAngular.js - An introduction for the unitiated
Angular.js - An introduction for the unitiatedthehoagie
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJSShyjal Raazi
 
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 2013Thomas Robbins
 
Developing great applications using ASP.NET MVC and ASP.NET AJAX
Developing great applications using ASP.NET MVC and ASP.NET AJAXDeveloping great applications using ASP.NET MVC and ASP.NET AJAX
Developing great applications using ASP.NET MVC and ASP.NET AJAXTatham Oddie
 
GraphQL IndyJS April 2016
GraphQL IndyJS April 2016GraphQL IndyJS April 2016
GraphQL IndyJS April 2016Brad Pillow
 

Was ist angesagt? (20)

Asp.net mvc 4
Asp.net mvc 4Asp.net mvc 4
Asp.net mvc 4
 
Samza sql stream processing meetup
Samza sql stream processing meetupSamza sql stream processing meetup
Samza sql stream processing meetup
 
Asp.net mvc basic introduction
Asp.net mvc basic introductionAsp.net mvc basic introduction
Asp.net mvc basic introduction
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
React vs-angular-mobile
React vs-angular-mobileReact vs-angular-mobile
React vs-angular-mobile
 
Baking With Cake Php
Baking With Cake PhpBaking With Cake Php
Baking With Cake Php
 
Introduction to Angular JS
Introduction to Angular JSIntroduction to Angular JS
Introduction to Angular JS
 
2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca
2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca
2019-05-16 aOS Luxembourg - 6 - Flow avancé - Serge Luca
 
Membangun Moderen UI dengan Vue.js
Membangun Moderen UI dengan Vue.jsMembangun Moderen UI dengan Vue.js
Membangun Moderen UI dengan Vue.js
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
Mvc3 crash
Mvc3 crashMvc3 crash
Mvc3 crash
 
Ember.js for Big Profit
Ember.js for Big ProfitEmber.js for Big Profit
Ember.js for Big Profit
 
ASP .NET MVC
ASP .NET MVC ASP .NET MVC
ASP .NET MVC
 
Angular.js - An introduction for the unitiated
Angular.js - An introduction for the unitiatedAngular.js - An introduction for the unitiated
Angular.js - An introduction for the unitiated
 
Use IBM Graph from NodeJS
Use IBM Graph from NodeJSUse IBM Graph from NodeJS
Use IBM Graph from NodeJS
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
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
 
Developing great applications using ASP.NET MVC and ASP.NET AJAX
Developing great applications using ASP.NET MVC and ASP.NET AJAXDeveloping great applications using ASP.NET MVC and ASP.NET AJAX
Developing great applications using ASP.NET MVC and ASP.NET AJAX
 
GraphQL IndyJS April 2016
GraphQL IndyJS April 2016GraphQL IndyJS April 2016
GraphQL IndyJS April 2016
 

Andere mochten auch

ZZ BC#7.5 asp.net mvc practice and guideline refresh!
ZZ BC#7.5 asp.net mvc practice  and guideline refresh! ZZ BC#7.5 asp.net mvc practice  and guideline refresh!
ZZ BC#7.5 asp.net mvc practice and guideline refresh! Chalermpon Areepong
 
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvpZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvpChalermpon Areepong
 
Build your website with angularjs and web apis
Build your website with angularjs and web apisBuild your website with angularjs and web apis
Build your website with angularjs and web apisChalermpon Areepong
 

Andere mochten auch (6)

J query
J queryJ query
J query
 
Gf vtzz-05--j queryshowcase
Gf vtzz-05--j queryshowcaseGf vtzz-05--j queryshowcase
Gf vtzz-05--j queryshowcase
 
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
ZZ BC#7.5 asp.net mvc practice  and guideline refresh! ZZ BC#7.5 asp.net mvc practice  and guideline refresh!
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
 
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvpZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
 
Build your website with angularjs and web apis
Build your website with angularjs and web apisBuild your website with angularjs and web apis
Build your website with angularjs and web apis
 
DevRock #02 akka.net intro part
DevRock #02 akka.net intro partDevRock #02 akka.net intro part
DevRock #02 akka.net intro part
 

Ähnlich wie Build your web app with asp.net mvc 2 from scratch

Asp.Net Mvc
Asp.Net MvcAsp.Net Mvc
Asp.Net Mvcmicham
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVCDzmitry Naskou
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To MvcVolkan Uzun
 
Spring-training-in-bangalore
Spring-training-in-bangaloreSpring-training-in-bangalore
Spring-training-in-bangaloreTIB Academy
 
ASP.NET MVC Fundamental
ASP.NET MVC FundamentalASP.NET MVC Fundamental
ASP.NET MVC Fundamentalldcphuc
 
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCCTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCBarry Gervin
 
Spring 3.x - Spring MVC
Spring 3.x - Spring MVCSpring 3.x - Spring MVC
Spring 3.x - Spring MVCGuy Nir
 
Writing RESTful web services using Node.js
Writing RESTful web services using Node.jsWriting RESTful web services using Node.js
Writing RESTful web services using Node.jsFDConf
 
C# Advanced L09-HTML5+ASP
C# Advanced L09-HTML5+ASPC# Advanced L09-HTML5+ASP
C# Advanced L09-HTML5+ASPMohammad Shaker
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Eliran Eliassy
 
E-MARKETING E-ZONE PPT Using ADVANCED JAVA
E-MARKETING E-ZONE PPT Using ADVANCED JAVAE-MARKETING E-ZONE PPT Using ADVANCED JAVA
E-MARKETING E-ZONE PPT Using ADVANCED JAVASudhanshu kumar Sah
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)Igor Bronovskyy
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Tuna Tore
 

Ähnlich wie Build your web app with asp.net mvc 2 from scratch (20)

A4 from rad to mvc
A4 from rad to mvcA4 from rad to mvc
A4 from rad to mvc
 
Asp.Net Mvc
Asp.Net MvcAsp.Net Mvc
Asp.Net Mvc
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVC
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
 
Spring-training-in-bangalore
Spring-training-in-bangaloreSpring-training-in-bangalore
Spring-training-in-bangalore
 
Spring Web MVC
Spring Web MVCSpring Web MVC
Spring Web MVC
 
ASP.NET MVC Fundamental
ASP.NET MVC FundamentalASP.NET MVC Fundamental
ASP.NET MVC Fundamental
 
Day7
Day7Day7
Day7
 
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCCTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVC
 
Spring 3.x - Spring MVC
Spring 3.x - Spring MVCSpring 3.x - Spring MVC
Spring 3.x - Spring MVC
 
Writing RESTful web services using Node.js
Writing RESTful web services using Node.jsWriting RESTful web services using Node.js
Writing RESTful web services using Node.js
 
Valentine with AngularJS
Valentine with AngularJSValentine with AngularJS
Valentine with AngularJS
 
ASP .Net MVC 5
ASP .Net MVC 5ASP .Net MVC 5
ASP .Net MVC 5
 
C# Advanced L09-HTML5+ASP
C# Advanced L09-HTML5+ASPC# Advanced L09-HTML5+ASP
C# Advanced L09-HTML5+ASP
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics
 
Sails.js Intro
Sails.js IntroSails.js Intro
Sails.js Intro
 
E-MARKETING E-ZONE PPT Using ADVANCED JAVA
E-MARKETING E-ZONE PPT Using ADVANCED JAVAE-MARKETING E-ZONE PPT Using ADVANCED JAVA
E-MARKETING E-ZONE PPT Using ADVANCED JAVA
 
my accadanic project ppt
my accadanic project pptmy accadanic project ppt
my accadanic project ppt
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
 

Build your web app with asp.net mvc 2 from scratch

  • 1. BUILD YOUR WEB APPLICATION WITH ASP.NET MVC 2 FROM SCRATCH ZZ Black Coffee #5 : Web Programming ChalermponAreepong : Nine (นาย) Greatfriends community lead Microsoft MVP : ASP.NET
  • 2. Agenda Demo Fast build web mvc application Routing Control Model View Unit Testing Extend MVC 2 DI/ Ajax/ Telirik MVC UI Question / Answer
  • 3. Demo Fast build web mvc application
  • 4. Routing Responsibility Map request to controller action Create out going Url corresponds with controller action Route Pattern Default parameter value routes.aMapRoute(“simple”, “{controller}/{action}/{id}”, new {id=“”}); Constraints with Regular Expression Cacheable - Data parameter
  • 5. Controller Action Method {action} = controller method Parameter {controller}/{action}/{id} {id} = parameter for controller method Multi parameter {controller}/{action}/{id},{name} routes.MapRoute(“hello,”say/hello/{id},{name}”, new { Controller = “say”, action = “hello”}); Default parameter test([DefaultValue(10)]int max) {…} C#4 test(int max = 10) {…}
  • 6. Controller (2) ActionResult is abstract class for return action result type ViewResult, RedirectResult, JsonResult, etc. Accept Verb [HttpGet] ActionResult Edit(string id){…} [HttpPost] ActionResult Edit(string id, FormCollection form) {…} Asynchronous Controller
  • 7. VIew Strong Typed Views public partial class Index : ViewPage<Product> {…} Controller : return View(product); ViewModel custom class to render view by requirement Html Helper class ViewEngine
  • 8. Model ViewModel Input Report DomainModel Business Object Business Rule Business Method Data Access ORM Repository Pattern
  • 9. Extend mvc AJAX Required MicrosoftAjax.js, MicrosoftMvcAjax.js Sample code view <%: Using(Ajax.BeginForm(“HelloAjax”, new AjaxOptions { UpdateTargetId = “results”})) { %> <%: Html.Textbox(“query”, null, new {size=40}) %> <input type=“submit /> <% } %> <div id=“results”> </div> Sample code controller public ActionResultHelloAjax(string query) { if(Request.IsAjaxRequest()) { return Content(“You entered” + query);} else { return RedirectToAction(“Index”, new {query = query}); } }