Exemple #1
0
        public async Task <IList <Photo> > FetchRange(int startIndex, int count)
        {
            var isAvailableRequest = await Syncronizer.Syncronizer.Current.IsAvailableRequest();

            if (!isAvailableRequest)
            {
                return(await _photoService.GetPhotos(startIndex, count));
            }

            if (_page != startIndex)
            {
                _page++;
            }

            var result = await _restService.Request().GetPhotos(_page, count, _sort);

            if (result == null || result.Count == 0)
            {
                return(new List <Photo>());
            }

            await _photoService.AddPhotos(result);

            return(result);
        }
Exemple #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            await _photoService.AddPhotos(Files);

            return(RedirectToPage("./Index"));
        }