public IActionResult UpdateFile(
            long documentId,
            IList <IFormFile> files)
        {
            Stream stream  = null;
            var    command = new UpdateFileToDocumentCommand {
                DocumentId = documentId,
            };

            if (files != null && files.Length() > 0)
            {
                var file = files[0];
                stream       = file.OpenReadStream();
                command.File = stream;
            }

            return(updateFileCommandHandler.Execute(command)
                   .Match(x => x.Match <IActionResult>(Ok, BadRequest),
                          ex => StatusCode(500, ex)));
        }
Beispiel #2
0
 ValidateFile(UpdateFileToDocumentCommand file)
 => from x in ValidateFieldNonNull(file, nameof(file))
 from y in (