Created
November 4, 2015 13:41
-
-
Save jmarmolejos/507c51440a66ef216c41 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void DownloadAndReadMetadata(int imageId) | |
| { | |
| // Get scheduled image from db | |
| var image = _context.ScheduledImages.Find(imageId); | |
| // Download file | |
| var stream = _downloader.Download(image.DownloadUrl); | |
| // Read metadata | |
| var metadata = _reader.ReadFromStream(stream); | |
| // Save entities | |
| image.JobCompletedDate = DateTime.UtcNow; | |
| _context.MarkAsModified(image); | |
| metadata.ForEach(tag => | |
| { | |
| tag.ScheduledImageId = imageId; | |
| _context.ImageMetadataTags.Add(tag); | |
| }); | |
| _context.SaveChanges(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment