public async Task <IHttpActionResult> PutScoccer(int id, Scoccer scoccer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != scoccer.ID) { return(BadRequest()); } db.Entry(scoccer).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ScoccerExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> PostScoccer(Scoccer scoccer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.scoccer.Add(scoccer); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = scoccer.ID }, scoccer)); }
public async Task <IHttpActionResult> DeleteScoccer(int id) { Scoccer scoccer = await db.scoccer.FindAsync(id); if (scoccer == null) { return(NotFound()); } db.scoccer.Remove(scoccer); await db.SaveChangesAsync(); return(Ok(scoccer)); }