* Fixed firewall rules check and improved the script the check shall be like ~ Get-NetFirewallRule -DisplayName eShopOnContainers-* -ErrorAction Stop * #1397: Replaced deprecated docker.for.win.localhost by host.docker.internal in src/.env (#1400) * Updated Readme (#1402) Fixed sentence structure in Readme. Changed "and a several" to "with several." * CatalogService: Fix issue with Status set when items list is empty (#1304) * Fix issue with Status set when items list is empty * Change method Count() call to Count property Co-authored-by: Dmytro Hridin <v-dmytro.hridin@lionbridge.com> * refactored Equals() method on ValueObject (#1316) * Fix/1403and1404 removed duplicate Key SubscriptionClientName and added app.UseAuthorization() call (#1406) * #1403 removed duplicate Key SubscriptionClientName Removed duplicate key SubscriptionClientName from Tests/Services/Application.FunctionalTests/Services/Marketing/appsettings.json and sorted its content in asc order. * #1404 Added app.UseAuthorization() call Added app.UseAuthorization() call to BasketTestsStartup, LocationsTestsStartup, and MarketingTestsStartup to fix failed unit tests IntegrationEventsScenarios.Post_update_product_price_and_catalog_and_basket_list_modified and MarketingScenarios.Set_new_user_location_and_get_location_campaign_by_user_id (see #1404) * Fix for Campaigns exception and SignalR 401 Unauthorized (#1374) * update API Gateway - /locations-api/ @ webmarketing/envoy.yaml * updated signalr services - envoy: webmarketingapigw - latest client: webmvc - service hub: ordering-signalrhub Co-authored-by: hfz-r <hafiz.roslan@hartalega.com.my> * Mis-Spelled 'client' (#1411) * fix parameter error in multiarch job (#1413) * Private readonly string changed to private const string (#1288) * fix disposing of direct instantiated objects in calalog service #1392 (#1395) * Updated version of different packages. (#1420) * for issue #1423: changed literal string "OpenIdConnect" to constant string (#1424) Co-authored-by: Jeremiah Flaga <j.flaga@arcanys.com> * Updated node-fetch package version. (#1426) * Updated node-fetch package version. * Updated node-forge version. * Fixes #1474: webspa container does not build when running docker-compose up.Updated sha hashes in packages-lock.json (#1475) * Change ReadAllBytes to ReadAllBytesAsync in PicController (#1425) Co-authored-by: edmondshtogu <edmondshtogu@gmail.com> Co-authored-by: InstanceFactory <InstanceFactory@users.noreply.github.com> Co-authored-by: Sumit Ghosh <sumit.ghosh@neudesic.com> Co-authored-by: Yosef Herskovitz <34112131+H3RSKO@users.noreply.github.com> Co-authored-by: Dmytro Hridin <dmytro.hridin@gmail.com> Co-authored-by: Dmytro Hridin <v-dmytro.hridin@lionbridge.com> Co-authored-by: André Silva <andrefilipegsilva@outlook.com> Co-authored-by: hfz-r <39443205+hfz-r@users.noreply.github.com> Co-authored-by: hfz-r <hafiz.roslan@hartalega.com.my> Co-authored-by: Majid Ali Khan Quaid <contactmakq@gmail.com> Co-authored-by: Javier Vela <fjvela@gmail.com> Co-authored-by: Facundo La Rocca <facundo_larocca@yahoo.com.ar> Co-authored-by: Nabil Sedoud <nsedoud@gmail.com> Co-authored-by: jeremiahflaga <flaga.jeremiah@gmail.com> Co-authored-by: Jeremiah Flaga <j.flaga@arcanys.com> Co-authored-by: Wojciech Rak <wojciechrak@users.noreply.github.com> Co-authored-by: Zakaria <23211915+zakaria-c@users.noreply.github.com>
39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
using Microsoft.eShopOnContainers.WebMVC;
|
|
using Microsoft.eShopOnContainers.WebMVC.Services;
|
|
using Microsoft.Extensions.Logging;
|
|
using Microsoft.Extensions.Options;
|
|
using Newtonsoft.Json;
|
|
using System.Net.Http;
|
|
using System.Threading.Tasks;
|
|
using WebMVC.Infrastructure;
|
|
using WebMVC.Services.ModelDTOs;
|
|
|
|
namespace WebMVC.Services
|
|
{
|
|
public class LocationService : ILocationService
|
|
{
|
|
private readonly IOptions<AppSettings> _settings;
|
|
private readonly HttpClient _httpClient;
|
|
private readonly ILogger<CampaignService> _logger;
|
|
private readonly string _remoteServiceBaseUrl;
|
|
|
|
public LocationService(HttpClient httpClient, IOptions<AppSettings> settings, ILogger<CampaignService> logger)
|
|
{
|
|
_httpClient = httpClient;
|
|
_settings = settings;
|
|
_logger = logger;
|
|
|
|
_remoteServiceBaseUrl = $"{_settings.Value.MarketingUrl}/l/api/v1/locations/";
|
|
}
|
|
|
|
public async Task CreateOrUpdateUserLocation(LocationDTO location)
|
|
{
|
|
var uri = API.Locations.CreateOrUpdateUserLocation(_remoteServiceBaseUrl);
|
|
var locationContent = new StringContent(JsonConvert.SerializeObject(location), System.Text.Encoding.UTF8, "application/json");
|
|
|
|
var response = await _httpClient.PostAsync(uri, locationContent);
|
|
response.EnsureSuccessStatusCode();
|
|
}
|
|
}
|
|
}
|