public IHttpActionResult PutGarcom(int id, Garcom garcom) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != garcom.Id) { return BadRequest(); } db.Entry(garcom).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!GarcomExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostGarcom(Garcom garcom) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Garcoms.Add(garcom); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = garcom.Id }, garcom); }