public ActionResult AddCategory(CategoryModel model) { var category = new Category(); if (ModelState.IsValid) { category.Description = model.Description; category.InsertDate = DateTime.Now; category.InsertUserId = CustomMembership.CurrentUser().Id; category.IsActive = model.IsActive; category.Name = model.Name; category.Order = model.Order; category.Slug = StringManager.ToSlug(model.Name); try { _categoryService.Insert(category); _uow.SaveChanges(); messagesForView.Clear(); messagesForView.Add("İşlemi başarılı!"); Success(messagesForView); return RedirectToAction("Index"); } catch (Exception ex) { messagesForView.Clear(); messagesForView.Add("İşlem başarısız!"); messagesForView.Add(ex.Message); messagesForView.Add(ex.InnerException.Message); Error(messagesForView); } } return View(model); }
public void Update(Category category) { _categoryRepository.Update(category); }
public void Insert(Category category) { _categoryRepository.Insert(category); }
public void Delete(Category category) { _categoryRepository.Delete(category); }