using System.Web.Http;
using System.Web.Mvc;

namespace Qusion.WebApp.Areas.cms
{
    public class cmsAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get
            {
                return "cms";
            }
        }

        public override void RegisterArea(AreaRegistrationContext context)
        {
            var config = GlobalConfiguration.Configuration;

            config.Routes.MapHttpRoute(
                name: "cmsApi",
                routeTemplate: "cms/api/{controller}/{action}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );

            // Register cms default route
            context.MapRoute(
                "cmsdefault",
                "cms/{controller}/{action}/{id}",
                new { controller = "App", action = "Index", id = UrlParameter.Optional },
                // todo: this is going to make troubles in case of same name controllers
                new[] { "Qusion.WebApp.Areas.cms.Controllers", "Qusion.WebApp.Controllers" }
                );
        }
    }
}
