public IHttpActionResult PutSpecial(int id, Special special) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != special.ID) { return BadRequest(); } db.Entry(special).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SpecialExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostSpecial(Special special) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Specials.Add(special); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = special.ID }, special); }