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
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