using System.Web.Mvc; using System.Web.Routing; using Microsoft.Practices.Unity; using Portoa.Web; using Portoa.Web.Models; using Portoa.Web.Unity; using UnityGenerics; using VideoGameQuotes.Api; using VideoGameQuotes.Api.Persistence; using VideoGameQuotes.Web.Security; using VideoGameQuotes.Web.Services; namespace VideoGameQuotes.Web { public class MvcApplication : MvcApplicationBase { protected override void ConfigureModelBinders(ModelBinderDictionary binders) { binders.Add(); } protected override void ConfigureUnity() { Container .AddNewExtension() .Configure() .SetName("VideoGameQuotes.Web") .UseXml(); Container .AddNewExtension() .RegisterType() .RegisterType(new InjectionProperty(attr => attr.UserProvider)) .RegisterType() .RegisterType() .RegisterType(); } protected override void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.IgnoreRoute("media/{*anything}"); routes.MapRoute("about", "about", new { controller = "Home", action = "About" }); routes.MapRoute("contact", "contact", new { controller = "Home", action = "Contact" }); routes.MapRoute("submit", "submit", new { controller = "Quote", action = "Submit" }); routes.MapRoute("create-category", "category/create", new { controller = "Quote", action = "CreateCategory" }); routes.MapRoute("individual-quote", "q/{id}/{*text}", new { controller = "Quote", action = "Quote" }, new { id = @"\d+" }); routes.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional }); } } }