public ActionResult EditProvider(int id) { ProviderBs bs = new ProviderBs(); ProviderModel model = (ProviderModel)bs.GetById(id); return(View(model)); }
public ActionResult ProvidersList(string symbols = "") { ProviderBs provider = new ProviderBs(); List <ProviderModel> model = provider.GetList().Where( c => c.Name.Contains(symbols) || c.Surname.Contains(symbols) || c.Patronymic.Contains(symbols)) .Select(c => (ProviderModel)c).ToList(); return(PartialView("~/Views/Admin/_ProvidersList.cshtml", model)); }
public ActionResult DeleteProvider(int id) { ProviderBs bs = new ProviderBs(); var result = bs.Delete(id); if (result.Code == BusinessLayer.OperationStatusEnum.Success) { TempData["OperationStatus"] = true; TempData["OpearionMessage"] = "Данные успешно удалены"; } else { TempData["OperationStatus"] = false; TempData["OpearionMessage"] = "Произошла ошибка при удалении данных"; } return(RedirectToAction("Providers", "Admin")); }
public ActionResult EditProvider(ProviderModel model) { if (ModelState.IsValid) { ProviderBs bs = new ProviderBs(); var result = bs.Update((ProviderDataDTO)model); if (result.Code == BusinessLayer.OperationStatusEnum.Success) { TempData["OperationStatus"] = true; TempData["OpearionMessage"] = "Данные успешно обновлены"; } else { TempData["OperationStatus"] = false; TempData["OpearionMessage"] = "Произошла ошибка при обновлении данных"; } return(RedirectToAction("Providers", "Admin")); } return(View(model)); }