// PUT api/EncampmentSite/5 public IHttpActionResult PutEncampmentSite(int id, EncampmentSite encampmentsite) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != encampmentsite.EncampmentSiteId) { return BadRequest(); } db.Entry(encampmentsite).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EncampmentSiteExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostEncampmentSite(EncampmentSite encampmentsite) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.EncampmentSites.Add(encampmentsite); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = encampmentsite.EncampmentSiteId }, encampmentsite); }