public IHttpActionResult PutSide(int id, Side side) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != side.SideID) { return BadRequest(); } db.Entry(side).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SideExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostSide(Side side) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Sides.Add(side); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = side.SideID }, side); }