public async Task <IActionResult> CountryEdit( GeoCountryViewModel model, int returnPageNumber = 1) { ViewData["Title"] = sr["Edit Country"]; if (!ModelState.IsValid) { return(View(model)); } string successFormat; if (model.Id == Guid.Empty) { successFormat = sr["The country {0} was successfully created."]; await dataManager.Add(model); } else { successFormat = sr["The country {0} was successfully updated."]; await dataManager.Update(model); } this.AlertSuccess(string.Format(successFormat, model.Name), true); return(RedirectToAction("CountryListPage", new { pageNumber = returnPageNumber })); }
public async Task <IActionResult> CountryEdit( GeoCountryViewModel model, int returnPageNumber = 1) { ViewBag.Title = "Edit Country"; if (!ModelState.IsValid) { return(View(model)); } bool result; string successFormat; if (model.Guid == Guid.Empty) { successFormat = "The country <b>{0}</b> was successfully created."; result = await dataManager.Add(model); } else { successFormat = "The country <b>{0}</b> was successfully updated."; result = await dataManager.Update(model); } if (result) { this.AlertSuccess(string.Format(successFormat, model.Name), true); } return(RedirectToAction("CountryListPage", new { pageNumber = returnPageNumber })); }