public IHttpActionResult PutSexWorkExploitation(int id, SexWorkExploitation sexWorkExploitation) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != sexWorkExploitation.SexWorkExploitationId) { return BadRequest(); } db.Entry(sexWorkExploitation).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SexWorkExploitationExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostSexWorkExploitation(SexWorkExploitation sexWorkExploitation) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.SexWorkExploitations.Add(sexWorkExploitation); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = sexWorkExploitation.SexWorkExploitationId }, sexWorkExploitation); }