예제 #1
0
        public async Task <ActionResult> PinComment(int commentId, bool isPinned)
        {
            var comment = commentsRepo.GetCommentById(commentId);

            if (!User.HasAccessFor(comment.CourseId, CourseRole.Instructor))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Forbidden));
            }

            await commentsRepo.PinComment(commentId, isPinned);

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
예제 #2
0
        public async Task <ActionResult> PinComment(int commentId, bool isPinned)
        {
            var comment = commentsRepo.FindCommentById(commentId);

            if (comment == null)
            {
                return(HttpNotFound());
            }

            if (!CanModerateComments(User, comment.CourseId))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Forbidden));
            }

            await commentsRepo.PinComment(commentId, isPinned);

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }