Ejemplo n.º 1
0
        // this action uploads the collection of files to the hard drive and returns the upload result
        public async Task <IActionResult> Upload(IFormFileCollection uploads, string folderId)
        {
            if (!_fileSystemService.CheckEditAccess(_fileSystemService.GetFolderById(folderId), User.FindFirstValue(ClaimTypes.NameIdentifier)))
            {
                throw new StatusCodeException($"You don't have access to folder with ID = {folderId}.", StatusCodes.Status403Forbidden);
            }

            List <ElementVM> elements = (await _fileSystemService.UploadFiles(uploads, _fileSystemService.GetFolderById(folderId))).ToList();

            return(new ObjectResult(elements));
        }