public IHttpActionResult PostPersonelKup(PersonelKup personelKup) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.PersonelKup.Add(personelKup); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = personelKup.PersonelKupId }, personelKup); }
public IHttpActionResult PutPersonelKup(int id, PersonelKup personelKup) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != personelKup.PersonelKupId) { return BadRequest(); } db.Entry(personelKup).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PersonelKupExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }