示例#1
0
        // 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);
        }
示例#2
0
        //// POST: api/Report
        public async Task <SubmittedReportViewModel> Post(ReportSubmissionViewModel entity)
        {
            var report = ReportSubmissionViewModel.MapToReport(entity);

            return(SubmittedReportViewModel.MapFromReport(_reportService.SaveReport(report)));
        }
示例#3
0
        // GET: api/Report/5
        public SubmittedReportViewModel Get(int id)
        {
            var report = _reportService.GetReport(id);

            return(SubmittedReportViewModel.MapFromReport(report));
        }