PageRenderTime 52ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/Passbook.Sample.Web/App_Start/RouteConfig.cs

https://github.com/Comezon/dotnet-passbook
C# | 51 lines | 41 code | 6 blank | 4 comment | 0 complexity | 092f653cf80bc542101ffa23baa42a7b MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Http;
  6. using System.Web.Mvc;
  7. using System.Web.Routing;
  8. namespace Passbook.Sample.Web
  9. {
  10. public class RouteConfig
  11. {
  12. public static void RegisterRoutes(RouteCollection routes)
  13. {
  14. routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  15. //api/version/devices/deviceLibraryIdentifier/registrations/passTypeIdentifier/serialNumber
  16. routes.MapHttpRoute(
  17. name: "RegistraterPass",
  18. routeTemplate: "api/{version}/devices/{deviceLibraryIdentifier}/registrations/{passTypeIdentifier}/{serialNumber}",
  19. defaults: new { Controller = "PassRegistration", Action = "Post" });
  20. //api/v1/devices/d754ba022bd37181fed36ead4e7cf5d8/registrations/pass.tomasmcguinness.com
  21. routes.MapHttpRoute(
  22. name: "FetchUpdatedPasses",
  23. routeTemplate: "api/{version}/devices/{deviceLibraryIdentifier}/registrations/{passTypeIdentifier}",
  24. defaults: new { Controller = "PassRegistration", Action = "Get" }
  25. );
  26. //api/version/passes/passTypeIdentifier/serialNumber
  27. routes.MapHttpRoute(
  28. name: "FetchPass",
  29. routeTemplate: "api/{version}/passes/{passTypeIdentifier}/{serialNumber}",
  30. defaults: new { Controller = "PassRegistration", Action = "GetPass" }
  31. );
  32. //api/version/passes/passTypeIdentifier/serialNumber
  33. routes.MapHttpRoute(
  34. name: "LogPass",
  35. routeTemplate: "api/{version}/log",
  36. defaults: new { Controller = "Log" }
  37. );
  38. routes.MapRoute(
  39. name: "Default",
  40. url: "{controller}/{action}/{id}",
  41. defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
  42. );
  43. }
  44. }
  45. }