public IHttpActionResult PutSpecial(int id, Special specials) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != specials.ID) { return BadRequest(); } db.Entry(specials).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); try { db.SaveChanges(); } catch (DbUpdateException) { if (SpecialExists(special.SpecialID)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = special.SpecialID }, special); }
public IHttpActionResult PostSpecial(Special specials) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Specials.Add(specials); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = specials.ID }, specials); }