KEMBAR78
5. web api 2 aspdotnet-mvc5-slides | PDF
ASP.NET MVC 5 Fundamentals
WebApi 2
K. Scott Allen
OdeToCode.com
@OdeToCode
Routing With Attributes
Route Description
[Route("patients/{id}/medications")] Easier to get to "nested" resources
[Route["patients/{id:int:min(1)}"] Constraints
[Route("patients/{id:int}")]
[Route["patients/{name:alpha}"]
Multiple routes per action
[Route("patients/{id?}")] Can apply to entire controller
[RoutePrefix("api/patients")] Prefix for all other routes in
controller
[RouteArea("Admin")] Attributes for MVC Areas
IHttpActionResult
CORS
 Cross Origin Resource Sharing
Origin: http://pluralsight.com
Access-Control-Allow-Origin: http://pluralsight.com
Summary

5. web api 2 aspdotnet-mvc5-slides

  • 1.
    ASP.NET MVC 5Fundamentals WebApi 2 K. Scott Allen OdeToCode.com @OdeToCode
  • 2.
    Routing With Attributes RouteDescription [Route("patients/{id}/medications")] Easier to get to "nested" resources [Route["patients/{id:int:min(1)}"] Constraints [Route("patients/{id:int}")] [Route["patients/{name:alpha}"] Multiple routes per action [Route("patients/{id?}")] Can apply to entire controller [RoutePrefix("api/patients")] Prefix for all other routes in controller [RouteArea("Admin")] Attributes for MVC Areas
  • 3.
  • 4.
    CORS  Cross OriginResource Sharing Origin: http://pluralsight.com Access-Control-Allow-Origin: http://pluralsight.com
  • 5.