コード例 #1
0
        public async Task <ActionResult <Comment> > CreateCommentFromBlog([FromBody] Comment newComment, int id)
        {
            try
            {
                Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>();

                newComment.CreatorId = userInfo.Id;
                newComment.BlogId    = id;
                Comment created = _bs.CreateCommentFromBlog(newComment);
                created.Creator = userInfo;
                return(Ok(created));
            }
            catch (System.Exception error)
            {
                return(BadRequest(error.Message));
            }
        }