public IHttpActionResult PutSubjectAction(int id, SubjectAction subjectAction) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != subjectAction.Id) { return BadRequest(); } db.Entry(subjectAction).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SubjectActionExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostSubjectAction(SubjectAction subjectAction) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.SubjectActions.Add(subjectAction); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = subjectAction.Id }, subjectAction); }