public ActionResult Location( RenderModel model, int id, string name) { IPublishedContent recommendationsRespository = Helper.TypedContentAtRoot().FirstOrDefault() .FirstChild(x => x.DocumentTypeAlias == Constants.NodeAlias.RECOMMENDATIONS_REPOSITORY); LocationModel locationModel = LocationFactory.Create(model.Content, recommendationsRespository, Services.ContentService, Site.IsEnglish, isDetails: true); string expectedName = locationModel.Title.ToSeoUrl(); string actualName = (name ?? "").ToLower(); // permanently redirect to the correct URL if (expectedName != actualName) { return(RedirectToActionPermanent(Constants.Controllers.Location.NAME, Constants.Controllers.Location.Actions.LOCATION, new { id = locationModel.Id, name = expectedName })); } return(CurrentTemplate(locationModel)); }
private List <Location> GenerateLocations(int lengte) { List <Location> locations = new List <Location>(); for (int i = 1; i <= lengte; i++) { string locationTypeString; switch (i) { case BridgeLocatie.BridgeLocation: locationTypeString = nameof(BridgeLocatie); break; case InnLocatie.InnLocation: locationTypeString = nameof(InnLocatie); break; case WellLocatie.WellLocation: locationTypeString = nameof(WellLocatie); break; case MazeLocatie.MazeLocation: locationTypeString = nameof(MazeLocatie); break; case PrisonLocatie.PrisonLocation: locationTypeString = nameof(PrisonLocatie); break; case DeathLocatie.DeathLocation: locationTypeString = nameof(DeathLocatie); break; case EndLocatie.EndLocation: locationTypeString = nameof(EndLocatie); break; default: locationTypeString = nameof(CasualLocatie); break; } Location locationType = _locationFactory.Create(locationTypeString, i); locations.Add(locationType); } return(locations); }