public ActionResult NewReport() { ReportViewModel report = new ReportViewModel(); report.Report = new Report(); report.Customers = customerRepo.ActiveCustomers; return View(report); }
public ActionResult EditReportModal(int reportId) { ReportViewModel report = new ReportViewModel(); report.Report = repository.Reports.FirstOrDefault(r => r.Id == reportId); report.Customers = customerRepo.ActiveCustomers; return PartialView(report); }
public String SaveReport(ReportViewModel reportModel) { Report report = reportModel.Report; var identity = ((CustomPrincipal)HttpContext.User).CustomIdentity; report.UserId = identity.UserId; String message = ""; if (ModelState.IsValid) { repository.SaveReport(report); } else { message = "Ett eller flera fält är fel ifyllda. Försök igen."; } return message; }