This commit is contained in:
MaxchilKH 2020-11-11 17:03:35 +01:00
parent 2176fbe661
commit 7fc9eef637

View File

@ -101,14 +101,13 @@ namespace InternshipSystem.Api.Controllers
var document = internship.Documentation.First(d => d.Id == documentId);
document.Scan = new DocumentScan
{
File = memoryStream.ToArray(),
Size = memoryStream.Length,
Filename = documentScan.FileName,
Mime = _fileValidator.GetFileMime(memoryStream.ToArray())
};
document.Scan ??= new DocumentScan();
document.Scan.Size = memoryStream.Length;
document.Scan.Filename = documentScan.FileName;
document.Scan.Mime = _fileValidator.GetFileMime(memoryStream.ToArray());
document.Scan.File = memoryStream.ToArray();
document.State = DocumentState.Submitted;
await _context.SaveChangesAsync(cancellationToken);