public bool Cadastrar(Cliente cliente, string cpf) { try { return(_clienteService.Cadastrar(cliente, cpf)); } catch (RegistroExisteException e) { throw new RegistroExisteException(e.Message); } catch (ConcorrenciaBancoException e) { throw new ConcorrenciaBancoException(e.Message); } }
public IActionResult Cadastrar([FromBody] ClienteViewModel clienteVm) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var cliente = _service.Cadastrar(clienteVm); if (_errorHandlerService.Errors.Any()) { return(BadRequest(_errorHandlerService.Errors)); } return(CreatedAtRoute("ObterCliente", new { id = cliente.Id }, cliente)); }
public IActionResult Cadastrar(Cliente entidade) { return(Ok(_servico.Cadastrar(entidade))); }
public async Task Cadastrar([FromBody] CadastrarModel cadastro) { await _cliente.Cadastrar(cadastro); }