public ActionResult delete(int id) { try { tblRuleService.DeleteByCollectionID(id); collectionProductService.DeleteByCollectionID(id); // delete image collection string folder = Server.MapPath("~/assets/uploads/collections/") + id; ImageService.DeleteFolder(folder); Collection collection = collectionService.GetByPrimaryKey(id); if (collection != null) { if (collectionService.DeleteByPrimary(id)) { LogService.WriteLog2DB(accountService.GetUserId(User.Identity.GetUserName()), (int)Common.ActionID.Insert, id, SDateTime.GetYYYYMMddHmmSSNow(), General.GetIPAddress(), TableNameID, collection.CollectionName); return(RedirectToAction("", "collections", new { strMessage = "delete1" })); } } return(RedirectToAction("detail", "collections", new { id = id, strError = "Xóa danh mục lỗi" })); } catch (Exception ex) { LogService.WriteException(ex); return(RedirectToAction("detail", "collections", new { id = id, strError = "Xóa danh mục lỗi" })); } }