예제 #1
0
 public ActionResult NewReport()
 {
     ReportViewModel report = new ReportViewModel();
     report.Report = new Report();
     report.Customers = customerRepo.ActiveCustomers;
     return View(report);
 }
예제 #2
0
 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);
 }
예제 #3
0
 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;
 }