private static ReviewInfo ToReviewInfo(ExerciseCodeReview r, bool isUlearnBot, [CanBeNull] Dictionary <int, IEnumerable <ExerciseCodeReviewComment> > reviewId2Comments) { var comments = reviewId2Comments?.GetValueOrDefault(r.Id); return(ReviewInfo.Build(r, comments, isUlearnBot)); }
public static ReviewInfo Build(ExerciseCodeReview r, [CanBeNull] IEnumerable <ExerciseCodeReviewComment> comments, bool isUlearnBot) { return(new ReviewInfo { Id = r.Id, Comment = r.Comment, RenderedComment = CommentTextHelper.RenderCommentTextToHtml(r.Comment), Author = isUlearnBot ? null : BaseController.BuildShortUserInfo(r.Author), AddingTime = isUlearnBot || r.AddingTime <= DateTime.UnixEpoch ? (DateTime?)null : r.AddingTime, FinishLine = r.FinishLine, FinishPosition = r.FinishPosition, StartLine = r.StartLine, StartPosition = r.StartPosition, Comments = comments .EmptyIfNull() .OrderBy(c => c.AddingTime) .Select(ReviewCommentResponse.Build) .ToList() }); }
public async Task UpdateExerciseCodeReview(ExerciseCodeReview review, string newComment) { review.Comment = newComment; await db.SaveChangesAsync().ConfigureAwait(false); }
public async Task DeleteExerciseCodeReview(ExerciseCodeReview review) { review.IsDeleted = true; await db.SaveChangesAsync().ConfigureAwait(false); }
public async Task DeleteExerciseCodeReview(ExerciseCodeReview review) { review.IsDeleted = true; await db.SaveChangesAsync(); }
public Task UpdateExerciseCodeReview(ExerciseCodeReview review, string newComment) { review.Comment = newComment; return(db.SaveChangesAsync()); }
public Task DeleteExerciseCodeReview(ExerciseCodeReview review) { review.IsDeleted = true; return(db.SaveChangesAsync()); }