public IEnumerable <Image> GetAll() { var metadata = _metadataRepository.GetAll().ToDictionary(key => key.ImageId); var images = _imageRepository.GetAll().ToList(); foreach (var image in images) { image.MimeType = metadata[image.Id].MimeType; } return(images); }
public IEnumerable <NoteViewItem> GetAll() { var metadata = _metadataRepository.GetAll().ToDictionary(key => key.NoteId); var notes = _notesRepository.GetAll(); foreach (var note in notes) { yield return(new NoteViewItem { Id = note.Id, ImageId = metadata[note.Id].ImageId, Text = note.Text, ThumbnailId = metadata[note.Id].ThumbnailId, }); } }