public ActionResult DeleteCategory(int id) { if (id > 0) { try { _categoryService.Delete((BlogCategory)_categoryService.GetByID(id)); return(Json(new { Message = "Category deleted!", Status = "success", ReturnUrl = "/Blog" })); } catch (Exception exc) { return(Json(new { Message = "Category failed to delete! You must remove all blog posts with this category before it can be deleted.", Status = "failed", ReturnUrl = "/Blog" })); } } return(Json(new { Message = "Category failed to delete! Category was null.", Status = "failed", ReturnUrl = "/Blog" })); }
public IActionResult Delete(int id) { if (id == 0) { return(new BadRequestResult()); } _blogCategoryService.Delete(id); _unitOfWork.Commit(); return(new OkObjectResult(id)); }
public IActionResult Delete(int id) { if (id == 0) { return(new BadRequestResult()); } else { _blogCategoryService.Delete(id); _blogCategoryService.Save(); return(new OkObjectResult(id)); } }
public IActionResult DeleteConfirmedBlog(int blogId) { var entity = _blogService.GetById(blogId); var blogcategories = _blogcategoryService.GetAll().Where(i => i.BlogId == blogId).ToList(); if (entity != null) { if (blogcategories != null) { foreach (var item in blogcategories) { _blogcategoryService.Delete(item); } } _blogService.Delete(entity); } TempData.Put("message", new ResultMessage() { Title = "Bildirim", Message = "Blog başarıyla silindi.", Css = "success" }); return(RedirectToAction("Blog")); }
public async Task <ActionResult> Delete(ForumPostCategoryViweModel model) { await _manageBlogCategory.Delete(model); return(View()); }