Exemplo n.º 1
0
        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)
            });
        }
Exemplo n.º 2
0
        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));
            }
        }
Exemplo n.º 3
0
        public async Task <IActionResult> ResponseReport(Guid id, [FromBody] ReportManageModel reportManageModel)
        {
            var response = await _reportService.ResponseReportAsync(id, reportManageModel);

            return(new CustomActionResult(response));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([FromBody] ReportManageModel reportManageModel)
        {
            var response = await _reportService.CreateReportAsync(reportManageModel);

            return(new CustomActionResult(response));
        }