Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Mvc 4.0
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. How?
• Using PPT
• Code Snippets and explanations
• Learn By doing
- Video library application
- Lab sessions
- learn by sharing
-
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. 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. 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. Routing
• Routes by HTTP methods (Get, Post, Put,
Delete)
• Other Methods available via [AcceptWorps]
• Looks at the start of an action name
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. 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
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. Async Awaite in MVC 4.0
• What is Async and Await
• Task Parallel Library
• Async Controls