gladyssann

WebApiConfig.cs

Dec 27th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web.Http;
  5. using Newtonsoft.Json;
  6. using Newtonsoft.Json.Serialization;
  7.  
  8. namespace Vidly
  9. {
  10. public static class WebApiConfig
  11. {
  12. public static void Register(HttpConfiguration config)
  13. {
  14. // using camel notation
  15. var settings = config.Formatters.JsonFormatter.SerializerSettings;
  16. settings.ContractResolver = new CamelCasePropertyNamesContractResolver();
  17. settings.Formatting = Formatting.Indented;
  18. // end camel notation
  19.  
  20. config.MapHttpAttributeRoutes();
  21.  
  22. config.Routes.MapHttpRoute(
  23. name: "DefaultApi",
  24. routeTemplate: "api/{controller}/{id}",
  25. defaults: new { id = RouteParameter.Optional }
  26. );
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment