public async Task <IHttpActionResult> PutTurfMaster(int id, TurfMaster turfMaster) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != turfMaster.Id) { return(BadRequest()); } db.Entry(turfMaster).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TurfMasterExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetTurfMaster(int id) { TurfMaster turfMaster = await db.TurfMasters.FindAsync(id); if (turfMaster == null) { return(NotFound()); } return(Ok(turfMaster)); }
public async Task <IHttpActionResult> PostTurfMaster(TurfMaster turfMaster) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.TurfMasters.Add(turfMaster); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = turfMaster.Id }, turfMaster)); }
public async Task <IHttpActionResult> DeleteTurfMaster(int id) { TurfMaster turfMaster = await db.TurfMasters.FindAsync(id); if (turfMaster == null) { return(NotFound()); } db.TurfMasters.Remove(turfMaster); await db.SaveChangesAsync(); return(Ok(turfMaster)); }