﻿using System.Web.Mvc;
using System.Web.Routing;
using System.Threading;

namespace adMoto.Payments.Web
{
    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("elmah.axd");
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            var lang = Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName.ToLower();

            routes.MapRoute(
                "eCard",
                "eCard/Status.aspx",
                new { controller = "eCard", action = "Status" }
                );

            routes.MapRoute(
                "ConfirmationOk",
                "{language}/Platnosc/Ok/{id}/{order}/",
                new { controller = "Platnosc", action = "Ok", id = "", order = "", language = "" }
                );

            routes.MapRoute(
                "ConfirmationFail",
                "{language}/Platnosc/Fail/{id}/",
                new { controller = "Platnosc", action = "Ok", id = "", order = "", language = "" }
                );

            routes.MapRoute(
                "Default",
                "{language}/{controller}/{action}/{id}",
                new { language = lang, controller = "Home", action = "Index", id = "" }
                );
        }
        protected void Application_Start()
        {
            RegisterRoutes(RouteTable.Routes);
        }

    }
}