public IHttpActionResult Include(Cliente obj) { if (!ModelState.IsValid) { return(BadRequest()); } _serviceCliente.Insert(obj); _serviceCliente.Commit(); return(Created(new Uri(Request.RequestUri.AbsoluteUri), obj)); }
public IActionResult RegisterCliente([FromBody] CreateClienteModel clienteModel) { try { var cliente = _serviceCliente.Insert(clienteModel); return(Created($"/api/Cadastro/{cliente.Id}", cliente.Id)); } catch (Exception e) { return(BadRequest(e)); } }