Beispiel #1
0
        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));
        }
Beispiel #2
0
        public IHttpActionResult PostCommentSkillTalent(CommentSkillTalent commentSkillTalent)
        {
            db.CommentSkillTalents.Add(commentSkillTalent);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = commentSkillTalent.CommentID }, commentSkillTalent));
        }
Beispiel #3
0
        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));
        }