public ActionResult DeleteCountryCulture(int countryId, int cultureId) { CountryCultureViewModel vm = _adminService.GetCountryCultureViewById(countryId, cultureId); vm.PreviousLink = this.Url.Action("EditCountry", "Admin", new { countryId }, this.Request.Url.Scheme); return(View(vm)); }
public void AddCountryCulture(CountryCultureViewModel model) { LocationCulture location = AutoMapper.Mapper.Map <LocationCulture>(model); location.CDate = DateTime.Now; UnitOfWork.LocationCultures.Add(location); UnitOfWork.SaveChanges(); UnitOfWork.ReloadContext(); }
public ActionResult AddCountryCulture(int countryId) { CountryCultureViewModel countryCultureVm = new CountryCultureViewModel(); countryCultureVm.CountryId = countryId; countryCultureVm.PreviousLink = this.Url.Action("EditCountry", "Admin", new { countryId }, this.Request.Url.Scheme); ViewBag.Cultures = _adminService.GetCultures(); return(View(countryCultureVm)); }
public ActionResult EditCountryCulture([Bind(Include = "CountryId, CountryName, CultureId")] CountryCultureViewModel model) { if (!ModelState.IsValid) { model.PreviousLink = this.Url.Action("EditCountry", "Admin", new { countryId = model.CountryId }, this.Request.Url.Scheme); return(View(model)); } _adminService.UpdateCountryCulture(model); return(RedirectToAction("EditCountry", new { countryId = model.CountryId })); }
public void UpdateCountryCulture(CountryCultureViewModel model) { var countryCultureFromDb = UnitOfWork.LocationCultures.FirstOrDefault( x => x.LocationId == model.CountryId && x.CultureId == model.CultureId); if (countryCultureFromDb == null) { throw new ArgumentNullException("Not found in database!"); } countryCultureFromDb.Name = model.CountryName; //countryCultureFromDb.CultureId = model.CultureId; UnitOfWork.SaveChanges(); }
public ActionResult DeleteCountryCulture([Bind(Include = "CountryId, CountryName, CultureId, CultureName")] CountryCultureViewModel model) { _adminService.DeleteCountryCulture(model.CountryId, model.CultureId); return(RedirectToAction("EditCountry", new { countryId = model.CountryId })); }