public MemoryStream GetEmployeePicture(Guid employeeId) { try { MemoryStream pictureStream = new MemoryStream(); binaryFiles.DownloadToStreamByName(employeeId.ToString(), pictureStream); return(pictureStream); } catch (GridFSFileNotFoundException) { return(null); } }
public void GetFile(string fileName, Stream destination) { if (fileName == null) { throw new ArgumentNullException(nameof(fileName)); } if (destination == null) { throw new ArgumentNullException(nameof(destination)); } _gridFsBucket.DownloadToStreamByName(fileName, destination); }