Exemplo n.º 1
0
        public async Task <ActionResult> DeleteExerciseCodeReview(string courseId, int reviewId)
        {
            var review = slideCheckingsRepo.FindExerciseCodeReviewById(reviewId);

            if (!string.Equals(review.ExerciseChecking.CourseId, courseId, StringComparison.OrdinalIgnoreCase))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Forbidden));
            }
            if (review.AuthorId != User.Identity.GetUserId() && !User.HasAccessFor(courseId, CourseRole.CourseAdmin))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Forbidden));
            }

            await slideCheckingsRepo.DeleteExerciseCodeReview(review);

            return(Json(new { status = "ok" }));
        }