public async Task<IHttpActionResult> PutClub(int id, Club club) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != club.Id) { return BadRequest(); } db.Entry(club).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClubExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostClub(Club club) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Clubs.Add(club); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = club.Id }, club); }