コード例 #1
0
        public async Task <IActionResult> UpdateGroupAsync(string slug, Guid userId, CancellationToken cancellationToken)
        {
            if (Request.ContentType != null && !MultipartRequestHelper.IsMultipartContentType(Request.ContentType))
            {
                return(BadRequest("The data submitted is not in the multiform format"));
            }
            var rowVersion = _etagService.GetIfMatch();
            await _groupService.UpdateGroupMultipartDocument(userId, slug, rowVersion, Request.Body, Request.ContentType, cancellationToken);

            return(Ok());
        }
コード例 #2
0
        public async Task <IActionResult> UpdateCommentAsync(Guid membershipUserId, string slug, Guid discussionId, Guid commentId, Comment comment, CancellationToken cancellationToken)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            comment.Content = _htmlSanitizer.Sanitize(comment.Content);
            var rowVersion = _etagService.GetIfMatch();
            await _commentService.UpdateCommentAsync(membershipUserId, slug, discussionId, commentId, comment, rowVersion, cancellationToken);

            return(Ok());
        }
コード例 #3
0
        public async Task <IActionResult> UpdateMemberRoleAsync(Guid adminUserId, Guid userId, [FromBody] MemberRoleUpdate memberRoleUpdate, CancellationToken cancellationToken)
        {
            var rowVersion = _etagService.GetIfMatch();

            memberRoleUpdate.MembershipUserId = userId;

            await _adminUserService.UpdateMemberRoleAsync(adminUserId, memberRoleUpdate, rowVersion, cancellationToken);

            return(Ok());
        }
コード例 #4
0
        public async Task <IActionResult> UpdateMemberAsync(Guid userId, Guid targetUserId, CancellationToken cancellationToken)
        {
            if (Request.ContentType != null && !MultipartRequestHelper.IsMultipartContentType(Request.ContentType))
            {
                return(BadRequest("The data submitted is not in the multiform format"));
            }

            var rowVersion = _etagService.GetIfMatch();

            await _userService.UpdateMemberAsync(userId, targetUserId, Request.Body, Request.ContentType, rowVersion, cancellationToken);

            return(Ok());
        }
コード例 #5
0
        public async Task <IActionResult> UpdateFolderAsync(Guid userId, string slug, Guid folderId, Folder folder, CancellationToken cancellationToken)
        {
            var sanitisedFolder = new Folder
            {
                Name        = _htmlSanitizer.Sanitize(folder.Name),
                Description = _htmlSanitizer.Sanitize(folder.Description)
            };
            var rowVersion = _etagService.GetIfMatch();

            await _folderService.UpdateFolderAsync(userId, slug, folderId, sanitisedFolder, rowVersion, cancellationToken);

            return(Ok());
        }