public IHttpActionResult PutKeyPerson1(int id, KeyPerson1 keyPerson1) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != keyPerson1.KeyPersons_id) { return(BadRequest()); } db.Entry(keyPerson1).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!KeyPerson1Exists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetKeyPerson1(int id) { KeyPerson1 keyPerson1 = db.KeyPersons1.Find(id); if (keyPerson1 == null) { return(NotFound()); } return(Ok(keyPerson1)); }
public IHttpActionResult PostKeyPerson1(KeyPerson1 keyPerson1) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.KeyPersons1.Add(keyPerson1); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = keyPerson1.KeyPersons_id }, keyPerson1)); }
public IHttpActionResult DeleteKeyPerson1(int id) { KeyPerson1 keyPerson1 = db.KeyPersons1.Find(id); if (keyPerson1 == null) { return(NotFound()); } db.KeyPersons1.Remove(keyPerson1); db.SaveChanges(); return(Ok(keyPerson1)); }