コード例 #1
0
        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));
        }
コード例 #2
0
ファイル: ChequeController.cs プロジェクト: DevMosaAlhaj/AMS
 public async Task <IActionResult> Create([FromBody] ChequeCreateDto dto)
 => await GetResponse(async (userId) =>
                      new ApiResponseViewModel(true, "Cheque Created Successfully", await _service.Create(dto, userId)));