コード例 #1
0
        public async Task <ActionResult <FormaPagamentoViewModel> > Adicionar(FormaPagamentoViewModel FormaPagamentoViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(CustomResponse(ModelState));
            }

            await _formaPagamentoService.Adicionar(_mapper.Map <FormaPagamento>(FormaPagamentoViewModel));

            return(CustomResponse(FormaPagamentoViewModel));
        }
コード例 #2
0
 public void Post([FromBody] FormaPagamento formaPagamento)
 {
     try
     {
         _service.Adicionar(formaPagamento);
     }
     catch (Exception)
     {
         Response.StatusCode = 400;
     }
 }