|
|
@ -13,6 +13,8 @@ namespace eShopOnContainers.Core.Services.Catalog |
|
|
|
{ |
|
|
|
private readonly IRequestProvider _requestProvider; |
|
|
|
private readonly IFixUriService _fixUriService; |
|
|
|
|
|
|
|
private const string ApiUrlBase = "mobileshoppingapigw/api/v1/c/catalog"; |
|
|
|
|
|
|
|
public CatalogService(IRequestProvider requestProvider, IFixUriService fixUriService) |
|
|
|
{ |
|
|
@ -22,8 +24,8 @@ namespace eShopOnContainers.Core.Services.Catalog |
|
|
|
|
|
|
|
public async Task<ObservableCollection<CatalogItem>> FilterAsync(int catalogBrandId, int catalogTypeId) |
|
|
|
{ |
|
|
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint); |
|
|
|
builder.Path = string.Format("api/v1/catalog/items/type/{0}/brand/{1}", catalogTypeId, catalogBrandId); |
|
|
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint); |
|
|
|
builder.Path = string.Format($"{ApiUrlBase}/items/type/{0}/brand/{1}", catalogTypeId, catalogBrandId); |
|
|
|
string uri = builder.ToString(); |
|
|
|
|
|
|
|
CatalogRoot catalog = await _requestProvider.GetAsync<CatalogRoot>(uri); |
|
|
@ -36,8 +38,8 @@ namespace eShopOnContainers.Core.Services.Catalog |
|
|
|
|
|
|
|
public async Task<ObservableCollection<CatalogItem>> GetCatalogAsync() |
|
|
|
{ |
|
|
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint); |
|
|
|
builder.Path = "api/v1/catalog/items"; |
|
|
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint); |
|
|
|
builder.Path = $"{ApiUrlBase}/items"; |
|
|
|
string uri = builder.ToString(); |
|
|
|
|
|
|
|
CatalogRoot catalog = await _requestProvider.GetAsync<CatalogRoot>(uri); |
|
|
@ -53,8 +55,8 @@ namespace eShopOnContainers.Core.Services.Catalog |
|
|
|
|
|
|
|
public async Task<ObservableCollection<CatalogBrand>> GetCatalogBrandAsync() |
|
|
|
{ |
|
|
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint); |
|
|
|
builder.Path = "api/v1/catalog/catalogbrands"; |
|
|
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint); |
|
|
|
builder.Path = $"{ApiUrlBase}/catalogbrands"; |
|
|
|
string uri = builder.ToString(); |
|
|
|
|
|
|
|
IEnumerable<CatalogBrand> brands = await _requestProvider.GetAsync<IEnumerable<CatalogBrand>>(uri); |
|
|
@ -67,8 +69,8 @@ namespace eShopOnContainers.Core.Services.Catalog |
|
|
|
|
|
|
|
public async Task<ObservableCollection<CatalogType>> GetCatalogTypeAsync() |
|
|
|
{ |
|
|
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint); |
|
|
|
builder.Path = "api/v1/catalog/catalogtypes"; |
|
|
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint); |
|
|
|
builder.Path = $"{ApiUrlBase}/catalogtypes"; |
|
|
|
string uri = builder.ToString(); |
|
|
|
|
|
|
|
IEnumerable<CatalogType> types = await _requestProvider.GetAsync<IEnumerable<CatalogType>>(uri); |
|
|
|