public async Task<IHttpActionResult> PutKinShip(int id, Kinship kinShip) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != kinShip.Id) { return BadRequest(); } db.Entry(kinShip).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!KinShipExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostKinShip(Kinship kinShip) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Kinships.Add(kinShip); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = kinShip.Id }, kinShip); }