fix/scan #80

Merged
maxchil merged 2 commits from fix/scan into master 2020-11-12 00:27:18 +01:00
Showing only changes of commit 7fc9eef637 - Show all commits

View File

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