public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); #region Home CultureInfo cultureFR = CultureInfo.GetCultureInfo("fr"); DictionaryRouteValueTranslationProvider homeActions = new DictionaryRouteValueTranslationProvider( new List<RouteValueTranslation> { new RouteValueTranslation(cultureFR, "add-space", "ajouter-espace"), new RouteValueTranslation(cultureFR, "how-it-works", "comment-ca-marche"), new RouteValueTranslation(cultureFR, "user-notice", "mode-d'emploi-utilisateur"), new RouteValueTranslation(cultureFR, "owner-notice", "mode-d'emploi-gerant"), new RouteValueTranslation(cultureFR, "pricing", "espace-gerant"), new RouteValueTranslation(cultureFR, "share-office", "partager-un-bureau"), new RouteValueTranslation(cultureFR, "about", "a-propos"), new RouteValueTranslation(cultureFR, "team", "l'equipe"), new RouteValueTranslation(cultureFR, "press", "presse") } ); //home index routes.CultureMapRoute( "", "", new { controller = "Home", action = "Index" }, null, new string[] { "Worki.Web.Controllers" }, new { action = homeActions } ); routes.SpecificCultureMapRoute( "", "accueil/{action}/", new { controller = "Home", action = "Index" }, null, new string[] { "Worki.Web.Controllers" }, "fr", new { action = homeActions } ); routes.CultureMapRoute( "", "home/{action}/", new { controller = "Home", action = "Index" }, null, new string[] { "Worki.Web.Controllers" }, new { action = homeActions } ); #endregion #region Profil routes.CultureMapRoute( "", "profil/{action}/{id}", new { controller = "Profil", action = "Default", id = UrlParameter.Optional }, new string[] { "Worki.Web.Controllers" } ); #endregion #region Account routes.CultureMapRoute( "", "account/{action}/{id}", new { controller = "Account", action = "Default", id = UrlParameter.Optional }, new string[] { "Worki.Web.Controllers" } ); #region Old Routes routes.CultureMapRoute( "", "compte/connexion/{id}", new { controller = "Account", action = "LogOn", id = UrlParameter.Optional }, new string[] { "Worki.Web.Controllers" } ); routes.CultureMapRoute( "", "compte/deconnexion/{id}", new { controller = "Account", action = "LogOff", id = UrlParameter.Optional }, new string[] { "Worki.Web.Controllers" } ); routes.CultureMapRoute( "", "compte/inscription/{id}", new { controller = "Account", action = "Register", id = UrlParameter.Optional }, new string[] { "Worki.Web.Controllers" } ); routes.CultureMapRoute( "", "compte/activer/{id}", new { controller = "Account", action = "Activate", id = UrlParameter.Optional }, new string[] { "Worki.Web.Controllers" } ); routes.CultureMapRoute( "", "compte/reset-mdp/{id}", new { controller = "Account", action = "ResetPassword", id = UrlParameter.Optional }, new string[] { "Worki.Web.Controllers" } ); routes.CultureMapRoute( "", "compte/{action}/{id}", new { controller = "Account", action = "Default", id = UrlParameter.Optional }, new string[] { "Worki.Web.Controllers" } ); #endregion #endregion #region Localisation DictionaryRouteValueTranslationProvider localisationTypes = new DictionaryRouteValueTranslationProvider( new List<RouteValueTranslation> { new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.SpotWifi, MiscHelpers.SeoConstantsFr.SpotWifi), new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.CoffeeResto, MiscHelpers.SeoConstantsFr.CoffeeResto), new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.Biblio, MiscHelpers.SeoConstantsFr.Biblio), new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.PublicSpace, MiscHelpers.SeoConstantsFr.PublicSpace), new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.TravelerSpace, MiscHelpers.SeoConstantsFr.TravelerSpace), new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.Hotel, MiscHelpers.SeoConstantsFr.Hotel), new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.Telecentre, MiscHelpers.SeoConstantsFr.Telecentre), new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.BuisnessCenter, MiscHelpers.SeoConstantsFr.BuisnessCenter), new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.CoworkingSpace, MiscHelpers.SeoConstantsFr.CoworkingSpace), new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.WorkingHotel, MiscHelpers.SeoConstantsFr.WorkingHotel), new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.PrivateArea, MiscHelpers.SeoConstantsFr.PrivateArea), new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.SharedOffice, MiscHelpers.SeoConstantsFr.SharedOffice) } ); routes.SpecificCultureMapRoute( "", // Nom d'itinéraire "{type}/{id}/{name}", // URL avec des paramètres new { area = "", controller = "Localisation", action = "Details" }, // Paramètres par défaut new { id = @"\d+", type = new FromValuesListConstraint(MiscHelpers.SeoConstants.AllLocalisationTypes) }, new string[] { "Worki.Web.Controllers" }, "fr", new { type = localisationTypes } ); routes.CultureMapRoute( "", // Nom d'itinéraire "{type}/{id}/{name}", // URL avec des paramètres new { area = "", controller = "Localisation", action = "Details" }, // Paramètres par défaut new { id = @"\d+", type = new FromValuesListConstraint(MiscHelpers.SeoConstants.AllLocalisationTypes) }, new string[] { "Worki.Web.Controllers" }, new { type = localisationTypes } ); routes.SpecificCultureMapRoute( "", // Nom d'itinéraire "{type}/{place}", // URL avec des paramètres new { controller = "Localisation", action = "FullSearchByTypeSeo" }, // Paramètres par défaut new { type = new FromValuesListConstraint(MiscHelpers.SeoConstants.AllLocalisationTypes) }, new string[] { "Worki.Web.Controllers" }, "fr", new { type = localisationTypes } ); routes.CultureMapRoute( "", // Nom d'itinéraire "{type}/{place}", // URL avec des paramètres new { controller = "Localisation", action = "FullSearchByTypeSeo" }, // Paramètres par défaut new { type = new FromValuesListConstraint(MiscHelpers.SeoConstants.AllLocalisationTypes) }, new string[] { "Worki.Web.Controllers" }, new { type = localisationTypes } ); DictionaryRouteValueTranslationProvider offerTypes = new DictionaryRouteValueTranslationProvider( new List<RouteValueTranslation> { new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.FreeArea, MiscHelpers.SeoConstantsFr.FreeArea), new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.BuisnessLounge, MiscHelpers.SeoConstantsFr.BuisnessLounge), new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.Workstation, MiscHelpers.SeoConstantsFr.Workstation), new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.Desktop, MiscHelpers.SeoConstantsFr.Desktop), new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.MeetingRoom, MiscHelpers.SeoConstantsFr.MeetingRoom), new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.SeminarRoom, MiscHelpers.SeoConstantsFr.SeminarRoom), new RouteValueTranslation(cultureFR, MiscHelpers.SeoConstants.VisioRoom, MiscHelpers.SeoConstantsFr.VisioRoom) } ); routes.SpecificCultureMapRoute( "", // Nom d'itinéraire "{offerType}/{place}", // URL avec des paramètres new { controller = "Localisation", action = "FullSearchByOfferSeo" }, // Paramètres par défaut new { offerType = new FromValuesListConstraint(MiscHelpers.SeoConstants.AllOfferTypes) }, new string[] { "Worki.Web.Controllers" }, "fr", new { offerType = offerTypes } ); routes.CultureMapRoute( "", // Nom d'itinéraire "{offerType}/{place}", // URL avec des paramètres new { controller = "Localisation", action = "FullSearchByOfferSeo" }, // Paramètres par défaut new { offerType = new FromValuesListConstraint(MiscHelpers.SeoConstants.AllOfferTypes) }, new string[] { "Worki.Web.Controllers" }, new { offerType = offerTypes } ); routes.CultureMapRoute( "", "workspaces/{action}/{place}/{lat}/{lng}/{type}/{offerType}/{page}/{order}/{index}", new { controller = "Localisation", action = "FullSearch" }, new string[] { "Worki.Web.Controllers" } ); routes.CultureMapRoute( "", // Nom d'itinéraire "workspaces/{action}/{id}", // URL avec des paramètres new { controller = "Localisation", action = "Index", id = UrlParameter.Optional }, // Paramètres par défaut new string[] { "Worki.Web.Controllers" } ); #endregion #region Rental routes.CultureMapRoute( "", // Nom d'itinéraire "rental/{action}/{id}", // URL avec des paramètres new { controller = "Rental", action = "Index", id = UrlParameter.Optional }, // Paramètres par défaut new string[] { "Worki.Web.Controllers" } ); #endregion #region Booking routes.CultureMapRoute( "", // Nom d'itinéraire "booking/{action}/{id}/{localisationId}", // URL avec des paramètres new { controller = "Booking", action = "Index", id = UrlParameter.Optional }, // Paramètres par défaut new string[] { "Worki.Web.Controllers" } ); #endregion #region Offer routes.CultureMapRoute( "", // Nom d'itinéraire "offer/{action}/{id}/{localisationId}", // URL avec des paramètres new { controller = "Offer", action = "Index", id = UrlParameter.Optional }, // Paramètres par défaut new string[] { "Worki.Web.Controllers" } ); #endregion #region Paypal routes.CultureMapRoute( "", "paywithpaypal/{memberBookingId}", new { controller = "Payment", action = "PayWithPayPal" }, new string[] { "Worki.Web.Controllers" } ); routes.CultureMapRoute( "", "paypalaccepted/{memberBookingId}", new { controller = "Payment", action = "PayPalAccepted" }, new string[] { "Worki.Web.Controllers" } ); routes.CultureMapRoute( "", "paypalcancelled/{memberBookingId}", new { controller = "Payment", action = "PayPalCancelled" }, new string[] { "Worki.Web.Controllers" } ); routes.CultureMapRoute( "", "paypalnotification", new { controller = "Payment", action = "PayPalInstantNotification" }, new string[] { "Worki.Web.Controllers" } ); #endregion routes.CultureMapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters, new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // Paramètres par défaut new string[] { "Worki.Web.Controllers" } ); //routing error handling routes.CultureMapRoute( "Error", "{*url}", new { controller = "Home", action = "Error" }, new string[] { "Worki.Web.Controllers" } ); }