// GET: api/Report public IEnumerable <SubmittedReportViewModel> Get() { var records = _reportService.GetReports(); if (records != null) { var reportViewModels = new List <SubmittedReportViewModel>(); foreach (var record in records) { reportViewModels.Add(SubmittedReportViewModel.MapFromReport(record)); } return(reportViewModels); } return(null); }
//// POST: api/Report public async Task <SubmittedReportViewModel> Post(ReportSubmissionViewModel entity) { var report = ReportSubmissionViewModel.MapToReport(entity); return(SubmittedReportViewModel.MapFromReport(_reportService.SaveReport(report))); }
// GET: api/Report/5 public SubmittedReportViewModel Get(int id) { var report = _reportService.GetReport(id); return(SubmittedReportViewModel.MapFromReport(report)); }