|
@ -20,7 +20,6 @@ namespace eShopOnContainers.Core.Services.Catalog |
|
|
|
|
|
|
|
|
public async Task<ObservableCollection<CatalogItem>> FilterAsync(int catalogBrandId, int catalogTypeId) |
|
|
public async Task<ObservableCollection<CatalogItem>> FilterAsync(int catalogBrandId, int catalogTypeId) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint); |
|
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint); |
|
|
|
|
|
|
|
|
builder.Path = string.Format("api/v1/catalog/items/type/{0}/brand/{1}", catalogTypeId, catalogBrandId); |
|
|
builder.Path = string.Format("api/v1/catalog/items/type/{0}/brand/{1}", catalogTypeId, catalogBrandId); |
|
@ -34,12 +33,10 @@ namespace eShopOnContainers.Core.Services.Catalog |
|
|
return catalog?.Data.ToObservableCollection(); |
|
|
return catalog?.Data.ToObservableCollection(); |
|
|
else |
|
|
else |
|
|
return new ObservableCollection<CatalogItem>(); |
|
|
return new ObservableCollection<CatalogItem>(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async Task<ObservableCollection<CatalogItem>> GetCatalogAsync() |
|
|
public async Task<ObservableCollection<CatalogItem>> GetCatalogAsync() |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint); |
|
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint); |
|
|
|
|
|
|
|
|
builder.Path = "api/v1/catalog/items"; |
|
|
builder.Path = "api/v1/catalog/items"; |
|
@ -56,32 +53,28 @@ namespace eShopOnContainers.Core.Services.Catalog |
|
|
return catalog?.Data.ToObservableCollection(); |
|
|
return catalog?.Data.ToObservableCollection(); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
return new ObservableCollection<CatalogItem>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ObservableCollection<CatalogItem>(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async Task<ObservableCollection<CatalogBrand>> GetCatalogBrandAsync() |
|
|
public async Task<ObservableCollection<CatalogBrand>> GetCatalogBrandAsync() |
|
|
{ |
|
|
{ |
|
|
|
|
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint); |
|
|
|
|
|
|
|
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint); |
|
|
|
|
|
|
|
|
|
|
|
builder.Path = "api/v1/catalog/catalogbrands"; |
|
|
|
|
|
|
|
|
|
|
|
string uri = builder.ToString(); |
|
|
|
|
|
|
|
|
builder.Path = "api/v1/catalog/catalogbrands"; |
|
|
|
|
|
|
|
|
IEnumerable<CatalogBrand> brands = |
|
|
|
|
|
await _requestProvider.GetAsync<IEnumerable<CatalogBrand>>(uri); |
|
|
|
|
|
|
|
|
string uri = builder.ToString(); |
|
|
|
|
|
|
|
|
if (brands != null) |
|
|
|
|
|
return brands?.ToObservableCollection(); |
|
|
|
|
|
else |
|
|
|
|
|
return new ObservableCollection<CatalogBrand>(); |
|
|
|
|
|
|
|
|
IEnumerable<CatalogBrand> brands = |
|
|
|
|
|
await _requestProvider.GetAsync<IEnumerable<CatalogBrand>>(uri); |
|
|
|
|
|
|
|
|
|
|
|
if (brands != null) |
|
|
|
|
|
return brands?.ToObservableCollection(); |
|
|
|
|
|
else |
|
|
|
|
|
return new ObservableCollection<CatalogBrand>(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async Task<ObservableCollection<CatalogType>> GetCatalogTypeAsync() |
|
|
public async Task<ObservableCollection<CatalogType>> GetCatalogTypeAsync() |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint); |
|
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint); |
|
|
|
|
|
|
|
|
builder.Path = "api/v1/catalog/catalogtypes"; |
|
|
builder.Path = "api/v1/catalog/catalogtypes"; |
|
@ -94,8 +87,7 @@ namespace eShopOnContainers.Core.Services.Catalog |
|
|
if (types != null) |
|
|
if (types != null) |
|
|
return types.ToObservableCollection(); |
|
|
return types.ToObservableCollection(); |
|
|
else |
|
|
else |
|
|
return new ObservableCollection<CatalogType>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ObservableCollection<CatalogType>(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |