public IHttpActionResult PutSeason(int id, Season season) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != season.Id) { return BadRequest(); } db.Entry(season).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SeasonExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostSeason(Season season) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Seasons.Add(season); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = season.Id }, season); }