Ejemplo n.º 1
0
        public async Task <IActionResult> GetPhotos(string ownerId)
        {
            var photoEntities = await photosRepository.GetPhotosAsync(ownerId);

            var photos = mapper.Map <IEnumerable <PhotoDto> >(photoEntities);

            return(Ok(photos.ToList()));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Index()
        {
            var ownerId       = GetOwnerId();
            var photoEntities = await photosRepository.GetPhotosAsync(ownerId);

            var photos = mapper.Map <IEnumerable <Photo> >(photoEntities);

            var model = new PhotoIndexModel(photos.ToList());

            return(View(model));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> GetPhotos(string ownerId)
        {
            var photoEntities = (await photosRepository.GetPhotosAsync(ownerId)).ToList();
            var photos        = mapper.Map <List <PhotoDto> >(photoEntities);

            foreach (var photo in photos)
            {
                photo.Url = GeneratePhotoUrl(photo);
            }
            return(Ok(photos.ToList()));
        }
Ejemplo n.º 4
0
 public async Task <List <Photo> > GetPhotosAsync(int amount = 10) => await repository.GetPhotosAsync(amount);
Ejemplo n.º 5
0
 public async Task <List <Photo> > GetPhotosAsync(int startIndex, int amount, CancellationToken cancellationToken) => await repository.GetPhotosAsync(startIndex, amount, cancellationToken);
Ejemplo n.º 6
0
 public async Task <List <Photo> > GetPhotosAsync(int number = 10) => await _photosRepository.GetPhotosAsync(number);
Ejemplo n.º 7
0
 public async Task <List <Photo> > GetPhotosAsync(int number = 0)
 {
     _logger.LogInformation("GetPhotosAsync called", number);
     return(await _photosRepository.GetPhotosAsync(number));
 }