Example #1
0
 // Оповещает о создании комментария к ревью, а не самого ревью (т.е. замечения к коду)
 private async Task NotifyAboutCodeReviewComment(ExerciseCodeReviewComment comment)
 {
     var courseId = comment.Review.ExerciseCheckingId.HasValue ? comment.Review.ExerciseChecking.CourseId : comment.Review.Submission.CourseId;
     await notificationsRepo.AddNotification(courseId, new ReceivedCommentToCodeReviewNotification
     {
         CommentId = comment.Id,
     }, comment.AuthorId);
 }
 public static ReviewCommentResponse Build(ExerciseCodeReviewComment comment)
 {
     return(new ReviewCommentResponse
     {
         Id = comment.Id,
         Text = comment.Text,
         RenderedText = CommentTextHelper.RenderCommentTextToHtml(comment.Text),
         PublishTime = comment.AddingTime,
         Author = BaseController.BuildShortUserInfo(comment.Author)
     });
 }
Example #3
0
        public async Task <ExerciseCodeReviewComment> AddExerciseCodeReviewComment(string authorId, int reviewId, string text)
        {
            var codeReviewComment = new ExerciseCodeReviewComment
            {
                AuthorId   = authorId,
                ReviewId   = reviewId,
                Text       = text,
                IsDeleted  = false,
                AddingTime = DateTime.Now,
            };

            db.ExerciseCodeReviewComments.Add(codeReviewComment);
            await db.SaveChangesAsync().ConfigureAwait(false);

            /* Extract review from database to fill review.Author by EF's DynamicProxy */
            return(db.ExerciseCodeReviewComments.AsNoTracking().FirstOrDefault(r => r.Id == codeReviewComment.Id));
        }
Example #4
0
 public async Task DeleteExerciseCodeReviewComment(ExerciseCodeReviewComment comment)
 {
     comment.IsDeleted = true;
     await db.SaveChangesAsync().ConfigureAwait(false);
 }