Exemplo n.º 1
0
        public async Task <IEnumerable <UnsplashImage> > Handle(GetBackgroundsQuery request,
                                                                CancellationToken cancellationToken)
        {
            var backgrounds = _mediaStore.GetBackgrounds();

            if (backgrounds != null)
            {
                return(backgrounds);
            }

            var newBackgrounds = (await _client.GetImagesAsync(cancellationToken)).ToList();

            _mediaStore.SetBackgrounds(newBackgrounds);

            return(newBackgrounds);
        }