public ActionResult EditCategory(EditCtegoryModel model) { if (categoryRepository.GetCategoryById(model.Id) != null) { categoryRepository.EditCategory(model.Id, model.Name, model.Description); return(RedirectToAction("Category", "Admin")); } ModelState.AddModelError("", "Сталась помилка"); return(View()); }
public ActionResult EditCategory(int id) { Category category = categoryRepository.GetCategoryById(id); if (category != null) { EditCtegoryModel model = new EditCtegoryModel() { Id = category.Id, Name = category.Name, Description = category.Description }; return(View(model)); } ModelState.AddModelError("", "Сталась помилка"); return(View()); }