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.

BlogAreaRegistration.cs 3.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System.Collections.Generic;
  2. using System.Web.Mvc;
  3. using System.Web.Optimization;
  4. using Teknik.Configuration;
  5. namespace Teknik.Areas.Blog
  6. {
  7. public class BlogAreaRegistration : AreaRegistration
  8. {
  9. public override string AreaName
  10. {
  11. get
  12. {
  13. return "Blog";
  14. }
  15. }
  16. public override void RegisterArea(AreaRegistrationContext context)
  17. {
  18. Config config = Config.Load();
  19. context.MapSubdomainRoute(
  20. "Blog.Blog", // Route name
  21. new List<string>() { "blog" }, // Subdomains
  22. new List<string>() { config.Host },
  23. "{username}", // URL with parameters
  24. new { controller = "Blog", action = "Blog", username = string.Empty }, // Parameter defaults
  25. new[] { typeof(Controllers.BlogController).Namespace }
  26. );
  27. context.MapSubdomainRoute(
  28. "Blog.New", // Route name
  29. new List<string>() { "blog" }, // Subdomains
  30. new List<string>() { config.Host },
  31. "{username}/New", // URL with parameters
  32. new { controller = "Blog", action = "NewPost", username = "" }, // Parameter defaults
  33. new[] { typeof(Controllers.BlogController).Namespace }
  34. );
  35. context.MapSubdomainRoute(
  36. "Blog.Edit", // Route name
  37. new List<string>() { "blog" }, // Subdomains
  38. new List<string>() { config.Host },
  39. "{username}/Edit/{id}", // URL with parameters
  40. new { controller = "Blog", action = "EditPost", username = "", id = 0 }, // Parameter defaults
  41. new[] { typeof(Controllers.BlogController).Namespace }
  42. );
  43. context.MapSubdomainRoute(
  44. "Blog.Post", // Route name
  45. new List<string>() { "blog" }, // Subdomains
  46. new List<string>() { config.Host },
  47. "{username}/p/{id}", // URL with parameters
  48. new { controller = "Blog", action = "Post", username = "", id = 0 }, // Parameter defaults
  49. new[] { typeof(Controllers.BlogController).Namespace }
  50. );
  51. context.MapSubdomainRoute(
  52. "Blog.Action", // Route name
  53. new List<string>() { "blog" }, // Subdomains
  54. new List<string>() { config.Host },
  55. "Action/{controller}/{action}", // URL with parameters
  56. new { controller = "Blog", action = "Blog" }, // Parameter defaults
  57. new[] { typeof(Controllers.BlogController).Namespace }
  58. );
  59. // Register Script Bundles
  60. BundleTable.Bundles.Add(new ScriptBundle("~/bundles/blog").Include(
  61. "~/Scripts/bootbox/bootbox.min.js",
  62. "~/Scripts/MarkdownDeepLib.min.js",
  63. "~/Areas/Blog/Scripts/Blog.js"));
  64. // Register Style Bundles
  65. BundleTable.Bundles.Add(new StyleBundle("~/Content/blog").Include(
  66. "~/Scripts/mdd_styles.css",
  67. "~/Areas/Blog/Content/Blog.css"));
  68. }
  69. }
  70. }