public ActionResult DeleteGallery(int id) { IGalleryService gallerySrv = IoC.Resolve <IGalleryService>(); Gallery model = gallerySrv.Getbykey(id); try { gallerySrv.Delete(model); gallerySrv.CommitChanges(); Messages.AddFlashMessage("Xóa thành công"); logSrv.CreateNew(FXContext.Current.CurrentUser.userid, "Gallery - Delete :" + id, "Delete Gallery Success", LogType.Success, HttpContext.Request.UserHostAddress, HttpContext.Request.Browser.Browser); } catch (Exception ex) { Messages.AddErrorFlashMessage("Không thể xóa"); logSrv.CreateNew(FXContext.Current.CurrentUser.userid, "Gallery - Delete :" + id, "Delete Gallery Error", LogType.Error, HttpContext.Request.UserHostAddress, HttpContext.Request.Browser.Browser); } return(RedirectToAction("IndexGallery", new { TypeId = model.TypeID })); }