public ActionResult EditLibrary(EditLibraryModel model) { if (ModelState.IsValid) { LibraryBs bs = new LibraryBs(); var result = bs.Update((LibraryDTO)model); if (result.Code == BusinessLayer.OperationStatusEnum.Success) { TempData["OperationStatus"] = true; TempData["OpearionMessage"] = "Данные успешно обновлены"; } else { TempData["OperationStatus"] = false; TempData["OpearionMessage"] = result.Message; } return(RedirectToAction("Libraries", "Admin")); } CityBs citybs = new CityBs(); model.Cities = citybs.GetList().Select(c => (CityModel)c).ToList(); return(View(model)); }
public ActionResult AddLibrary() { EditLibraryModel model = new EditLibraryModel(); CityBs bs = new CityBs(); model.Cities = bs.GetList().Select(c => (CityModel)c).ToList(); return(View(model)); }
public ActionResult EditLibrary(int id) { LibraryBs libbs = new LibraryBs(); EditLibraryModel model = (EditLibraryModel)libbs.GetById(id); CityBs bs = new CityBs(); model.Cities = bs.GetList().Select(c => (CityModel)c).ToList(); return(View(model)); }