public ActionResult Edit(Guid id, ReportPageModel model) { using (Muse db = new Muse()) { int flag = db.Update(model, true); if (flag > 0) { return(RedirectToAction("Index")); } else { return(View()); } } }
// GET: ReportPage/Details/5 public ActionResult Details(Guid id) { using (Muse db = new Muse()) { ReportPageModel record = db.Get <ReportPageModel>(x => x.Id == id, new[] { "ReportOptionModels", "ReportOptionModels.ReportDataSetModel", "ReportOptionModels.ReportDataSetModel.ReportDataSourceModel" }); record.ReportOptions = record.ReportOptions.OrderBy(x => x.Row).ThenBy(x => x.Column).ToList(); List <ReportDataSourceModel> DataSourceList = db.Gets <ReportDataSourceModel>(x => x.CreateUser == User.Identity.Name, new[] { "ReportDataSetModels" }).ToList(); ViewBag.DataSourceList = DataSourceList; ViewBag.ReportOptionTypeList = ReportOptionTypeList; return(View(record)); } }
public ActionResult Delete(Guid id, ReportPageModel model) { using (Muse db = new Muse()) { var record = db.Get <ReportPageModel>(x => x.Id == id, null); int flag = db.Del(record, true); if (flag > 0) { return(RedirectToAction("Index")); } else { return(View()); } } }
public IActionResult Index() { var model = new ReportPageModel(); var user = _userFactory.GetUser(User.Identity.Name); if (user == null) { throw new ApplicationException("No record of such user"); } model.MyReports = _reportFactory.GetReportsForUser(user.Id); if (User.IsInRole(WebConstants.UserRole)) { model.UserMode = true; model.UserIds = new List <int>() { user.Id }; } if (User.IsInRole(WebConstants.PartnerRole)) { if (user.PartnerId == null) { throw new ApplicationException("The current user has the permissions of a Partner, but isn't tied to any"); } model.PartnerMode = true; model.PartnerIds = new List <int>() { user.PartnerId.Value }; model.PartnerReports = _reportFactory.GetPartnerReports(user.PartnerId); } if (User.IsInRole(WebConstants.AdminRole)) { model.AdminReports = _reportFactory.GetAllReports(); } return(View("Index", model)); }
public ActionResult Create(ReportPageModel model) { using (Muse db = new Muse()) { model.Id = Guid.NewGuid(); model.CreateUser = User.Identity.Name; int flag = db.Add(model, true); if (flag > 0) { return(RedirectToAction("Index")); } else { return(View()); } } }