public IHttpActionResult PutCommentSkillTalent(int id, CommentSkillTalent commentSkillTalent) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != commentSkillTalent.CommentID) { return(BadRequest()); } db.Entry(commentSkillTalent).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CommentSkillTalentExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostCommentSkillTalent(CommentSkillTalent commentSkillTalent) { db.CommentSkillTalents.Add(commentSkillTalent); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = commentSkillTalent.CommentID }, commentSkillTalent)); }
public IHttpActionResult DeleteCommentSkillTalent(int id) { CommentSkillTalent commentSkillTalent = db.CommentSkillTalents.Find(id); if (commentSkillTalent == null) { return(NotFound()); } db.CommentSkillTalents.Remove(commentSkillTalent); db.SaveChanges(); return(Ok(commentSkillTalent)); }