public async Task <IHttpActionResult> PutPostDetail(int id, PostDetail postDetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != postDetail.id) { return(BadRequest()); } db.Entry(postDetail).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PostDetailExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> PutIndividu(int id, Individu individu) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != individu.Id) { return(BadRequest()); } db.Entry(individu).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IndividuExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }