Exemplo n.º 1
0
 public async Task AddComment(AddCommentRequest request)
 {
     DateTime now     = DateTime.Now;
     User     user    = _userRepository.GetUserByName(request.Author);
     string   avatar  = user.UserAvatar;
     Comment  comment = new Comment {
         PostId = request.PostId, Body = request.Body, Author = user.Login, AuthorAvatar = avatar, CreateDate = now
     };
     await _repository.AddComment(comment);
 }
Exemplo n.º 2
0
        public IActionResult AddCommentToReview(int id, [FromBody] AddCommentModel model)
        {
            var cmt = _mapper.Map <Comment>(model);

            cmt.UserId   = int.Parse(User.Identity.Name);
            cmt.ReviewId = id;
            try
            {
                _forumService.AddComment(cmt);
                return(Ok());
            }
            catch (AppException ex)
            {
                return(BadRequest(new { message = ex.Message }));
            }
        }
Exemplo n.º 3
0
 public ActionResult AddReply(Comment com)
 {
     _forumRepository.AddComment(com);
     return(RedirectToAction("Post", com.PostId));
 }