Exemple #1
0
 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());
 }
Exemple #2
0
        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());
        }