public SolutionCommentViewModel(Sql.Models.SolutionComment comment, string currentUser)
        {
            _comment = comment;

            DeleteCommentUrl = $"/solution/comment/{comment.SolutionCommentId}";

            Commentor = new UserViewModel(comment.Commentor, currentUser);
        }
Example #2
0
        public async Task <SolutionCommentViewModel> AddComment(int id, string comment)
        {
            var currentUser = await GetRequestUser();

            var solutionComment = new Sql.Models.SolutionComment();

            solutionComment.SolutionId = id;
            solutionComment.Comment    = comment;
            solutionComment.Commentor  = currentUser;
            solutionComment            = await Repository.Comments.AddSolutionComment(solutionComment);

            return(new SolutionCommentViewModel(solutionComment, currentUser.Identity));
        }