Exemplo n.º 1
0
        // adds a comment to an specific application and returns the comment as a DTO
        public CommentDto AddCommentToApplication(Guid applicationId, CommentCreateDto comment)
        {
            var newComment = comment.ToModel();

            newComment.ApplicationId = applicationId;

            _applicationDbContext.Comment.Add(newComment);
            Save();
            return(_applicationDbContext.Comment.Include(dto => dto.User)
                   .SingleOrDefault(dto => dto.Id == newComment.Id)
                   .ToDto());
        }