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)); }
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)); }