public async Task <IActionResult> Create(ChequeCreateWebRequest request) { var serviceResp = await _chequeService.Create( new ChequeCreateRequest(Db) { Name = request.Name, Amount = request.Amount, }); if (serviceResp.Success) { Db.SaveChanges(); } WebResponse.Messages.AddRange(serviceResp.Messages); WebResponse.Data = new { serviceResp.Cheque, serviceResp.AmountInWords }; WebResponse.Success = !WebResponse.Messages.Any(x => x.Type == Message.MessageType.Error); return(Ok(WebResponse)); }
public async Task <IActionResult> Create([FromBody] ChequeCreateDto dto) => await GetResponse(async (userId) => new ApiResponseViewModel(true, "Cheque Created Successfully", await _service.Create(dto, userId)));