public ActionResult LocationIndoorNew(string countryUrlPart, string areaNameUrlPart, LocationIndoorNewViewModel m) { PerformLocationAddValidation(areaNameUrlPart, m.Latitude, m.Longitude, m.Name, AppLookups.Country(countryUrlPart), true); if (ModelState.IsValid) { var location = geoSvc.CreateLocationIndoor(new LocationIndoor() { Address = m.Address, MapAddress = m.Address, CountryID = m.CountryID, Latitude = m.Latitude, Longitude = m.Longitude, Name = m.Name, Website = m.Website, TypeID = m.TypeID }); return Redirect(location.SlugUrl); } else { var country = AppLookups.Country(countryUrlPart); ViewBag.Country = country; var area = new GeoService().GetArea(country.ID, areaNameUrlPart); ViewBag.Area = area; ViewBag.ExistingLocations = new GeoService().GetLocationsOfArea(area.ID).Where( a => a.Type == CfType.CommercialIndoorClimbing || a.Type == CfType.PrivateIndoorClimbing).ToList(); return View(m); } }
public ActionResult LocationIndoorNew(string countryUrlPart, string areaNameUrlPart, LocationIndoorNewViewModel m) { PerformLocationAddValidation(areaNameUrlPart, m.Latitude, m.Longitude, m.Name, AppLookups.Country(countryUrlPart), true); if (ModelState.IsValid) { var location = geoSvc.CreateLocationIndoor(new LocationIndoor() { Address = m.Address, MapAddress = m.Address, CountryID = m.CountryID, Latitude = m.Latitude, Longitude = m.Longitude, Name = m.Name, Website = m.Website, TypeID = m.TypeID }); return(Redirect(location.SlugUrl)); } else { var country = AppLookups.Country(countryUrlPart); ViewBag.Country = country; var area = new GeoService().GetArea(country.ID, areaNameUrlPart); ViewBag.Area = area; ViewBag.ExistingLocations = new GeoService().GetLocationsOfArea(area.ID).Where( a => a.Type == CfType.CommercialIndoorClimbing || a.Type == CfType.PrivateIndoorClimbing).ToList(); return(View(m)); } }