The next generation of the Teknik Services. Written in ASP.NET. Fork for blog tags.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

BlogAreaRegistration.cs 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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.Post", // Route name
  29. new List<string>() { "blog" }, // Subdomains
  30. new List<string>() { config.Host },
  31. "{username}/{id}", // URL with parameters
  32. new { controller = "Blog", action = "Post", username = "", id = 0 }, // Parameter defaults
  33. new[] { typeof(Controllers.BlogController).Namespace }
  34. );
  35. context.MapSubdomainRoute(
  36. "Blog.Action", // Route name
  37. new List<string>() { "blog" }, // Subdomains
  38. new List<string>() { config.Host },
  39. "Action/{controller}/{action}", // URL with parameters
  40. new { controller = "Blog", action = "Blog" }, // Parameter defaults
  41. new[] { typeof(Controllers.BlogController).Namespace }
  42. );
  43. // Register Script Bundles
  44. BundleTable.Bundles.Add(new ScriptBundle("~/bundles/blog").Include(
  45. "~/Scripts/bootbox/bootbox.min.js",
  46. "~/Scripts/MarkdownDeepLib.min.js",
  47. "~/Areas/Blog/Scripts/Blog.js"));
  48. // Register Style Bundles
  49. BundleTable.Bundles.Add(new StyleBundle("~/Content/blog").Include(
  50. "~/Areas/Blog/Content/Blog.css"));
  51. }
  52. }
  53. }