Mvc 4.0

559 views

Published on

ASP.NET MVC 4.0 Training PPT

Published in: Software, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
559
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
15
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Mvc 4.0

  1. 1. ASP.NET MVC 4.0 By Ram Ayyalaraju co-founder, CTO ShikshaCLUB.com Twitter: @RamAyyalaraju LinkedIn: https://www.linkedin.com/in/ramayyalaraju Website: ShikshaCLUB.com email: ram.ayyalaraju@shikshaclub.com
  2. 2. How? • Using PPT • Code Snippets and explanations • Learn By doing - Video library application - Lab sessions - learn by sharing -
  3. 3. What is new in ASP.NET MVC 4? • WebAPI • Task Support for Sync controllers • Data Base Migrations – What’s New? • Bundling and Magnifications features – What is new? • More support for mobile development In this Order
  4. 4. WebAPI • To Embrace HTTP • Light weight • Scalable (caching) • Interoperable(no plugins and works with any client ) • Flexible (custom model bindings, formatters and filters) • Can pass-through firewalls • routes by http methods like get, post, put, delete verbs
  5. 5. Getting Started • Create a WebAPI Project • Create an ASP.NET Project • Create Any Project! Install NuGet Package Install-package Microsoft.Asp.Net.WebApi.SelfHost • Build example project with controllers, views and basic class lib to work
  6. 6. Routing • Routes by HTTP methods (Get, Post, Put, Delete) • Other Methods available via [AcceptWorps] • Looks at the start of an action name
  7. 7. WebAPI Routing cont... • public class RouteConfig • { • public static void RegisterRoutes(RouteCollection routes) • { • routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); • routes.MapRoute( • name: "Default", • url: "{controller}/{action}/{id}", • defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } • ); • } • }
  8. 8. Routing cont… • Response in browser • Response with cURL cmd line util cURL Download url: http://curl.haxx.se/download.html ex: http://localhost:1341/api/videos (controller name) • WebAPI supports multiple Get methods with different signatures, it’s not true with MVC • Put/ Delete examples
  9. 9. WebAPI Content Negotiation • Core mechanism of HTTP • Client specifies desired formats using Accept hearder • <<Diagram>>
  10. 10. WebAPI Content Negotiation…cont GlobalConfiguration.Configuration.Formatters Count = 4 [0]: {System.Net.Http.Formatting.JsonMediaTypeFormatter} [1]: {System.Net.Http.Formatting.XmlMediaTypeFormatter} [2]: {System.Net.Http.Formatting.FormUrlEncodedMediaTypeF ormatter} [3]: {System.Web.Http.ModelBinding.JQueryMvcFormUrlEncod edFormatter}
  11. 11. Action Parameters • How Get, Post, Put, Delete works • Primitive types (assumed not to be in message body) • Complex types (assumed to be in message boday) • Only Single model is allowed from message boday • <<Implementing PUT and POST by example>>
  12. 12. Async Awaite in MVC 4.0 • What is Async and Await • Task Parallel Library • Async Controls
  13. 13. Asycn Awit Example • <<Example Code walk through >>
  14. 14. Async Controler • AsyncControls base class • <<How it’s used in MVC by Example>>

×