public IHttpActionResult PutProp(int id, Prop prop) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != prop.PropId) { return BadRequest(); } db.Entry(prop).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PropExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostProp(Prop prop) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Props.Add(prop); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = prop.PropId }, prop); }