public async Task <ActionResult <IEnumerable <Photo> > > GetPhotos(int startIndex, int amount, CancellationToken cancellationToken) { List <Photo> photos = await service.GetPhotosAsync(startIndex, amount, cancellationToken); photos.ForEach(p => p.ImageUrl = Url.Link(nameof(GetImage), new { id = p.Id })); return(photos); }
public async Task <ActionResult <IEnumerable <Photo> > > GetPhotos() { List <Photo> photos = (await service.GetPhotosAsync()).ToList(); photos.ForEach(p => p.ImageUrl = Url.Link(nameof(GetImage), new { id = p.Id })); return(photos); }
//[Authorize] public override async Task <GetPhotosReply> GetPhotos(GetPhotosRequest request, ServerCallContext context) { List <Photo> photos = await photosService.GetPhotosAsync(request.Number); var r = new GetPhotosReply(); r.Photos.AddRange(photos.Select(ph => ph.ToGetPhotoReplyItem())); return(r); }
public async Task <IEnumerable <AlbumAndPhoto> > GetAlbumsAndPhotosAsync() { IEnumerable <AlbumAndPhoto> albumsAndPhotosAggregated = new List <AlbumAndPhoto>(); IEnumerable <Album> albums = await _albumsService.GetAlbumsAsync(); if (albums == null || !albums.Any()) { return(albumsAndPhotosAggregated); } IEnumerable <Photo> photos = await _photosService.GetPhotosAsync(); if (photos == null || !photos.Any()) { return(albumsAndPhotosAggregated); } albumsAndPhotosAggregated = _albumsAndPhotosHelper.GetAggregatedAlbumsAndPhotosResult(albums, photos); return(albumsAndPhotosAggregated); }
public async Task <ActionResult <IEnumerable <Photo> > > GetPhotos(int number) { return(await photosService.GetPhotosAsync(number)); }
public async Task <ActionResult <IEnumerable <Photo> > > GetPhotos() => await service.GetPhotosAsync();
public JsonResult Get() { var ret = _photosServices.GetPhotosAsync(); return(Json(ret.Result)); }