public IHttpActionResult PutEncampmentVisit(int id, EncampmentVisit encampmentvisit) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != encampmentvisit.EncampmentVisitId) { return BadRequest(); } db.Entry(encampmentvisit).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EncampmentVisitExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostEncampmentVisit(EncampmentVisit encampmentvisit) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.EncampmentVisits.Add(encampmentvisit); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = encampmentvisit.EncampmentVisitId }, encampmentvisit); }