public IHttpActionResult PutAssistiveAnswer(int id, AssistiveAnswer assistiveAnswer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != assistiveAnswer.ID) { return(BadRequest()); } db.Entry(assistiveAnswer).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AssistiveAnswerExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostAssistiveAnswer(AssistiveAnswer assistiveAnswer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.AssistiveAnswer.Add(assistiveAnswer); try { db.SaveChanges(); } catch (DbUpdateException) { if (AssistiveAnswerExists(assistiveAnswer.ID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = assistiveAnswer.ID }, assistiveAnswer)); }
public IHttpActionResult GetAssistiveAnswer(int id) { AssistiveAnswer assistiveAnswer = db.AssistiveAnswer.Find(id); if (assistiveAnswer == null) { return(NotFound()); } return(Ok(assistiveAnswer)); }
public IHttpActionResult DeleteAssistiveAnswer(int id) { AssistiveAnswer assistiveAnswer = db.AssistiveAnswer.Find(id); if (assistiveAnswer == null) { return(NotFound()); } db.AssistiveAnswer.Remove(assistiveAnswer); db.SaveChanges(); return(Ok(assistiveAnswer)); }