public async Task <IActionResult> Post([FromForm] string author, IFormFile file) { if (string.IsNullOrWhiteSpace(author)) { throw new ArgumentException("Author cannot be empty"); } if (file == null || file.Length == 0) { throw new ArgumentException("File cannot be empty"); } if (string.IsNullOrWhiteSpace(file.FileName)) { throw new ArgumentException("File name cannot be empty"); } byte[] fileBytes = FileProcessor.GetFileBytes(file); Document doc = new Document(author, file.FileName, fileBytes, DateTime.Now); await documentProcessor.AddDocumentAsync(doc); return(CreatedAtAction(nameof(Get), new { author = doc.Author, additionDate = doc.AdditionDate.ToString(CultureInfo.InvariantCulture) })); }