public async Task <IEnumerable <PhotoAlbumDto> > Handle(GetAllPhotoAlbum request, CancellationToken cancellationToken) { var photos = await _photoAlbumClient.GetPhoto(); IEnumerable <AlbumDto> albums = await _photoAlbumClient.GetAlbum(); var toSend = albums.Select(o => new PhotoAlbumDto() { Album = o, Photos = GetPhotoByAlbumId(o.Id, photos) }); return(toSend); }
public async Task <IEnumerable <PhotoAlbumDto> > Handle(GetPhotoAlbumForUser request, CancellationToken cancellationToken) { var photos = await _photoAlbumClient.GetPhoto(); IEnumerable <AlbumDto> albums = await _photoAlbumClient.GetAlbum(); if (request.UserId != null) { albums = albums.Where(o => o.UserId == request.UserId); } var toSend = albums.Select(o => new PhotoAlbumDto() { Album = o, Photos = GetPhotoByAlbumId(o.Id, photos) }); return(toSend); }