public IHttpActionResult PutAttributeInfoCandidate(int id, AttributeInfoCandidate attributeInfoCandidate) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != attributeInfoCandidate.AttributeInfoCandidateID) { return BadRequest(); } db.Entry(attributeInfoCandidate).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AttributeInfoCandidateExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostAttributeInfoCandidate(AttributeInfoCandidate attributeInfoCandidate) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.AttributesInfoCandidates.Add(attributeInfoCandidate); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = attributeInfoCandidate.AttributeInfoCandidateID }, attributeInfoCandidate); }