public async Task <ResponseModel> CreateReportAsync(ReportManageModel reportManageModel) { var report = _mapper.Map <Report>(reportManageModel); await _reportRepository.InsertAsync(report); report = await GetAll().FirstOrDefaultAsync(x => x.Id == report.Id); return(new ResponseModel() { StatusCode = System.Net.HttpStatusCode.OK, Data = new ReportViewModel(report) }); }
public async Task <ResponseModel> ResponseReportAsync(Guid id, ReportManageModel reportManageModel) { var report = await _reportRepository.GetByIdAsync(id); if (report == null) { return(new ResponseModel { StatusCode = System.Net.HttpStatusCode.NotFound, Message = "This Report is not exist!" }); } else { reportManageModel.GetReportFromModel(report); return(await _reportRepository.UpdateAsync(report)); } }
public async Task <IActionResult> ResponseReport(Guid id, [FromBody] ReportManageModel reportManageModel) { var response = await _reportService.ResponseReportAsync(id, reportManageModel); return(new CustomActionResult(response)); }
public async Task <IActionResult> Create([FromBody] ReportManageModel reportManageModel) { var response = await _reportService.CreateReportAsync(reportManageModel); return(new CustomActionResult(response)); }