public ActionResult DeleteMetaReport(MetaReportDeleteModel model) { ViewBag.MenuItem = CurrentMenuItem; var metaReport = _unitOfWork.Repository <MetaReport>() .Queryable() .SingleOrDefault(r => r.Id == model.MetaReportId); if (metaReport != null) { if (ModelState.IsValid) { if (metaReport.IsSystem) { ModelState.AddModelError("ReportName", "SYSTEM REPORT. Unable to delete."); } if (ModelState.IsValid) { _unitOfWork.Repository <MetaReport>().Delete(metaReport); _unitOfWork.Complete(); HttpCookie cookie = new HttpCookie("PopUpMessage"); cookie.Value = "Report deleted successfully"; Response.Cookies.Add(cookie); return(Redirect("/Reports/Index")); } } } return(View(model)); }
public ActionResult DeleteMetaReport(int metaReportId) { ViewBag.MenuItem = CurrentMenuItem; var metaReport = _unitOfWork.Repository <MetaReport>() .Queryable() .SingleOrDefault(r => r.Id == metaReportId); if (metaReport == null) { ViewBag.Entity = "Meta Report"; return(View("NotFound")); } // Prepare model var model = new MetaReportDeleteModel { MetaReportId = metaReport.Id, ReportDefinition = Server.HtmlDecode(metaReport.ReportDefinition), ReportName = Server.HtmlDecode(metaReport.ReportName) }; return(View(model)); }