public async Task <IActionResult> DownloadFile( [FromQuery] Guid personUniqueId, [FromQuery] string uniqueCode, [FromQuery] long fileId, [FromServices] DocumentsManager manager) { var customFile = await manager.GetFileAsync(User.Identity.Name, personUniqueId, uniqueCode, fileId); var ms = new MemoryStream(customFile.FileContents); return(File(ms, customFile.ContentType, customFile.FileName)); }