Ejemplo n.º 1
0
        public async Task <IActionResult> PutLikeCommentPosts(int id, LikeCommentPost likeCommentPost)
        {
            if (id != likeCommentPost.Id)
            {
                return(BadRequest());
            }

            _context.Entry(likeCommentPost).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LikeCommentPostExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetLikeCommentPost", new { id = likeCommentPost.Id }, likeCommentPost));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <LikeCommentPost> > PostLikeCommentPost(LikeCommentPost like)
        {
            _context.LikeCommentPosts.Add(like);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (LikeCommentPosttExists(like.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(like);
        }