示例#1
0
        public async Task <HttpResponseMessage> UpdateInstanceFolder(int folderId, [FromBody] FolderDto folderDto)
        {
            if (folderDto == null)
            {
                throw new BadRequestException(ErrorMessages.ModelIsEmpty, ErrorCodes.BadRequest);
            }

            await _privilegesManager.Demand(Session.UserId, InstanceAdminPrivileges.ManageProjects);

            FolderValidator.ValidateModel(folderDto, folderId);

            await _instanceRepository.UpdateFolderAsync(folderId, folderDto);

            return(Request.CreateResponse(HttpStatusCode.NoContent));
        }
示例#2
0
        public async Task <HttpResponseMessage> CreateFolder(FolderDto folder)
        {
            if (folder == null)
            {
                throw new BadRequestException(ErrorMessages.ModelIsEmpty, ErrorCodes.BadRequest);
            }

            await _privilegesManager.Demand(Session.UserId, InstanceAdminPrivileges.ManageProjects);

            FolderValidator.ValidateModel(folder);

            var folderId = await _instanceRepository.CreateFolderAsync(folder);

            return(Request.CreateResponse(HttpStatusCode.Created, folderId));
        }