The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AdminAreaRegistration.cs 3.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System.Collections.Generic;
  2. using System.Web.Mvc;
  3. using System.Web.Optimization;
  4. using Teknik.Configuration;
  5. using Teknik.Utilities;
  6. namespace Teknik.Areas.Admin
  7. {
  8. public class AdminAreaRegistration : AreaRegistration
  9. {
  10. public override string AreaName
  11. {
  12. get
  13. {
  14. return "Admin";
  15. }
  16. }
  17. public override void RegisterArea(AreaRegistrationContext context)
  18. {
  19. Config config = Config.Load();
  20. context.MapSubdomainRoute(
  21. "Admin.Dashboard", // Route name
  22. new List<string>() { "admin" }, // Subdomains
  23. new List<string>() { config.Host },
  24. "", // URL with parameters
  25. new { controller = "Admin", action = "Dashboard" }, // Parameter defaults
  26. new[] { typeof(Controllers.AdminController).Namespace }
  27. );
  28. context.MapSubdomainRoute(
  29. "Admin.Search", // Route name
  30. new List<string>() { "admin" }, // Subdomains
  31. new List<string>() { config.Host },
  32. "Search/Users", // URL with parameters
  33. new { controller = "Admin", action = "Search" }, // Parameter defaults
  34. new[] { typeof(Controllers.AdminController).Namespace }
  35. );
  36. context.MapSubdomainRoute(
  37. "Admin.UploadSearch", // Route name
  38. new List<string>() { "admin" }, // Subdomains
  39. new List<string>() { config.Host },
  40. "Search/Uploads", // URL with parameters
  41. new { controller = "Admin", action = "UploadSearch" }, // Parameter defaults
  42. new[] { typeof(Controllers.AdminController).Namespace }
  43. );
  44. context.MapSubdomainRoute(
  45. "Admin.UserInfo", // Route name
  46. new List<string>() { "admin" }, // Subdomains
  47. new List<string>() { config.Host },
  48. "User/{username}", // URL with parameters
  49. new { controller = "Admin", action = "UserInfo", username = string.Empty }, // Parameter defaults
  50. new[] { typeof(Controllers.AdminController).Namespace }
  51. );
  52. context.MapSubdomainRoute(
  53. "Admin.Action", // Route name
  54. new List<string>() { "admin" }, // Subdomains
  55. new List<string>() { config.Host },
  56. "Action/{controller}/{action}", // URL with parameters
  57. new { controller = "Admin", action = "Dashboard" }, // Parameter defaults
  58. new[] { typeof(Controllers.AdminController).Namespace }
  59. );
  60. // Register Script Bundles
  61. BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/Search", config.CdnHost).Include(
  62. "~/Areas/Admin/Scripts/Search.js"));
  63. // Register Script Bundles
  64. BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/UploadSearch", config.CdnHost).Include(
  65. "~/Scripts/bootbox/bootbox.min.js",
  66. "~/Areas/Admin/Scripts/UploadSearch.js"));
  67. BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/UserInfo", config.CdnHost).Include(
  68. "~/Areas/Admin/Scripts/UserInfo.js"));
  69. }
  70. }
  71. }