public async Task <IHttpActionResult> PutAppreciationAgree(int id, AppreciationAgree appreciationAgree) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != appreciationAgree.AppreciationAgreeId) { return(BadRequest()); } db.Entry(appreciationAgree).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AppreciationAgreeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetAppreciationAgree(int id) { AppreciationAgree appreciationAgree = await db.AppreciationAgrees.FindAsync(id); if (appreciationAgree == null) { return(NotFound()); } return(Ok(appreciationAgree)); }
public async Task <IHttpActionResult> PostAppreciationAgree(AppreciationAgree appreciationAgree) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.AppreciationAgrees.Add(appreciationAgree); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = appreciationAgree.AppreciationAgreeId }, appreciationAgree)); }
public async Task <IHttpActionResult> DeleteAppreciationAgree(int id) { AppreciationAgree appreciationAgree = await db.AppreciationAgrees.FindAsync(id); if (appreciationAgree == null) { return(NotFound()); } db.AppreciationAgrees.Remove(appreciationAgree); await db.SaveChangesAsync(); return(Ok(appreciationAgree)); }