public async Task<IHttpActionResult> PostExtractoCliente(ExtractoCliente extractoCliente) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.ExtractosCliente.Add(extractoCliente); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (ExtractoClienteExists(extractoCliente.Empresa)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = extractoCliente.Empresa }, extractoCliente); }
public async Task<IHttpActionResult> PutExtractoCliente(string id, ExtractoCliente extractoCliente) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != extractoCliente.Empresa) { return BadRequest(); } db.Entry(extractoCliente).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ExtractoClienteExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }