public GalleryController(
     IImageGalleryHttpClient imageGalleryHttpClient,
     IConfiguration configuration)
 {
     _imageGalleryHttpClient = imageGalleryHttpClient;
     _configuration          = configuration;
 }
Exemple #2
0
        public async Task <IActionResult> Images([FromServices] IImageGalleryHttpClient imageGalleryHttpClient, [FromServices] ImageGalleryConfig config)
        {
            //for test
            await WriteOutIdentityInformation();

            var imagesViewModel = new ImagesViewModel();

            // call the API
            var httpClient = await imageGalleryHttpClient.GetClient();

            var response = await httpClient.GetAsync("Api/Image/GetImages").ConfigureAwait(false);

            if (response.IsSuccessStatusCode)
            {
                var imagesAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

                var imageItems = JsonConvert.DeserializeObject <IList <ImageItem> >(imagesAsString).ToList();
                foreach (var imageItem in imageItems)
                {
                    imageItem.Url = config.BaseUri + imageItem.Url;
                }
                imagesViewModel.Images = imageItems;
            }
            return(View(imagesViewModel));
        }
 public GalleryController(IImageGalleryHttpClient imageGalleryHttpClient)
 {
     _imageGalleryHttpClient = imageGalleryHttpClient;
 }
Exemple #4
0
 public GalleryController(IOptions <ConfigurationOptions> settings, IImageGalleryHttpClient imageGalleryHttpClient)
 {
     ApplicationSettings     = settings.Value;
     _imageGalleryHttpClient = imageGalleryHttpClient;
 }
 public AddImageModel(IImageGalleryHttpClient imageGalleryHttpClient)
 {
     _imageGalleryHttpClient = imageGalleryHttpClient;
 }
Exemple #6
0
 public IndexModel(IImageGalleryHttpClient imageGalleryHttpClient)
 {
     _imageGalleryHttpClient = imageGalleryHttpClient;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GalleryApiCommandController"/> class.
 /// </summary>
 /// <param name="settings"></param>
 /// <param name="imageGalleryHttpClient"></param>
 /// <param name="logger"></param>
 public GalleryApiCommandController(IOptions <ApplicationOptions> settings, IImageGalleryHttpClient imageGalleryHttpClient, ILogger <GalleryApiCommandController> logger)
 {
     _logger = logger;
     _imageGalleryHttpClient = imageGalleryHttpClient;
     ApplicationSettings     = settings.Value;
 }