public async Task <IActionResult> AddReply(string commentId, [FromBody] AddReplyDTO model)
        {
            var loggedInUser = await _userManager.GetUserAsync(User);

            var result = await _repliesServices.CreateReply(commentId, loggedInUser, model);

            if (!result.Success)
            {
                return(BadRequest(result));
            }
            return(Created("", result));
        }
        public async Task AddReplyTest()
        {
            //arrange
            var addReplyDto = new AddReplyDTO()
            {
                Reply = "hi guys, its Easter already"
            };

            //act
            AddReplyMockUp(true);
            var editReplyApi = await _feedController.AddReply("commentId", addReplyDto) as CreatedResult;

            AddReplyMockUp(false);
            var editReplyApi1 = await _feedController.AddReply("commentId", addReplyDto) as BadRequestObjectResult;

            //assert
            Assert.IsInstanceOf <CreatedResult>(editReplyApi);
            Assert.IsInstanceOf <BadRequestObjectResult>(editReplyApi1);
        }
        public async Task <Response <ReplyDTO> > CreateReply(string commentId, User user, AddReplyDTO dto)
        {
            var response = new Response <ReplyDTO>();
            var comment  = _commentsRepo.GetById(commentId);

            if (comment is null)
            {
                response.Message = "Wrong comment id";
                return(response);
            }
            var reply = new Replies
            {
                Reply     = dto.Reply,
                CommentId = commentId,
                UserId    = user.Id
            };

            if (await _repliesRepo.Add(reply))
            {
                var clientReply = new ReplyDTO
                {
                    Id        = reply.Id,
                    Reply     = reply.Reply,
                    UserId    = user.Id,
                    CommentId = commentId
                };

                response.Success = true;
                response.Message = "comment added successful";
                response.Data    = clientReply;
                return(response);
            }

            response.Message = "oops! something went wrong";
            return(response);
        }