public async Task<IHttpActionResult> PutCarrosModels(int id, CarrosModels carrosModels) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != carrosModels.Id) { return BadRequest(); } db.Entry(carrosModels).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CarrosModelsExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostCarrosModels(CarrosModels carrosModels) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Carros.Add(carrosModels); await db.SaveChangesAsync(); return Ok(carrosModels); }