Removing pokemon catches. #75
This commit is contained in:
parent
12a734380c
commit
485e8faf03
@ -9,19 +9,13 @@ namespace eShopOnContainers.Core.Extensions
|
|||||||
{
|
{
|
||||||
ObservableCollection<T> collection = new ObservableCollection<T>();
|
ObservableCollection<T> collection = new ObservableCollection<T>();
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
foreach (T item in source)
|
foreach (T item in source)
|
||||||
{
|
{
|
||||||
collection.Add(item);
|
collection.Add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return collection;
|
return collection;
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return collection;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,8 +17,7 @@ namespace eShopOnContainers.Core.Services.Basket
|
|||||||
|
|
||||||
public async Task<CustomerBasket> GetBasketAsync(string guidUser, string token)
|
public async Task<CustomerBasket> GetBasketAsync(string guidUser, string token)
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint);
|
||||||
|
|
||||||
builder.Path = guidUser;
|
builder.Path = guidUser;
|
||||||
@ -31,20 +30,10 @@ namespace eShopOnContainers.Core.Services.Basket
|
|||||||
ServicesHelper.FixBasketItemPictureUri(basket?.Items);
|
ServicesHelper.FixBasketItemPictureUri(basket?.Items);
|
||||||
|
|
||||||
return basket;
|
return basket;
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return new CustomerBasket
|
|
||||||
{
|
|
||||||
BuyerId = guidUser,
|
|
||||||
Items = new System.Collections.Generic.List<BasketItem>()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<CustomerBasket> UpdateBasketAsync(CustomerBasket customerBasket, string token)
|
public async Task<CustomerBasket> UpdateBasketAsync(CustomerBasket customerBasket, string token)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint);
|
||||||
|
|
||||||
@ -54,11 +43,6 @@ namespace eShopOnContainers.Core.Services.Basket
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
catch
|
|
||||||
{
|
|
||||||
return new CustomerBasket();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task ClearBasketAsync(string guidUser, string token)
|
public async Task ClearBasketAsync(string guidUser, string token)
|
||||||
{
|
{
|
||||||
|
@ -20,8 +20,7 @@ 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)
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
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);
|
||||||
@ -35,17 +34,12 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
return catalog?.Data.ToObservableCollection();
|
return catalog?.Data.ToObservableCollection();
|
||||||
else
|
else
|
||||||
return new ObservableCollection<CatalogItem>();
|
return new ObservableCollection<CatalogItem>();
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return new ObservableCollection<CatalogItem>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ObservableCollection<CatalogItem>> GetCatalogAsync()
|
public async Task<ObservableCollection<CatalogItem>> GetCatalogAsync()
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
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";
|
||||||
@ -63,11 +57,7 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
return new ObservableCollection<CatalogItem>();
|
return new ObservableCollection<CatalogItem>();
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return new ObservableCollection<CatalogItem>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<CatalogItem> GetCatalogItemAsync(string id)
|
public Task<CatalogItem> GetCatalogItemAsync(string id)
|
||||||
@ -77,8 +67,7 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
|
|
||||||
public async Task<ObservableCollection<CatalogBrand>> GetCatalogBrandAsync()
|
public async Task<ObservableCollection<CatalogBrand>> GetCatalogBrandAsync()
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
|
||||||
|
|
||||||
builder.Path = "api/v1/catalog/catalogbrands";
|
builder.Path = "api/v1/catalog/catalogbrands";
|
||||||
@ -92,17 +81,12 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
return brands?.ToObservableCollection();
|
return brands?.ToObservableCollection();
|
||||||
else
|
else
|
||||||
return new ObservableCollection<CatalogBrand>();
|
return new ObservableCollection<CatalogBrand>();
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return new ObservableCollection<CatalogBrand>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ObservableCollection<CatalogType>> GetCatalogTypeAsync()
|
public async Task<ObservableCollection<CatalogType>> GetCatalogTypeAsync()
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
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";
|
||||||
@ -116,11 +100,7 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
return types.ToObservableCollection();
|
return types.ToObservableCollection();
|
||||||
else
|
else
|
||||||
return new ObservableCollection<CatalogType>();
|
return new ObservableCollection<CatalogType>();
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return new ObservableCollection<CatalogType>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,7 @@ namespace eShopOnContainers.Core.Services.Order
|
|||||||
|
|
||||||
public async Task<ObservableCollection<Models.Orders.Order>> GetOrdersAsync(string token)
|
public async Task<ObservableCollection<Models.Orders.Order>> GetOrdersAsync(string token)
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.OrdersEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.OrdersEndpoint);
|
||||||
|
|
||||||
builder.Path = "api/v1/orders";
|
builder.Path = "api/v1/orders";
|
||||||
@ -39,11 +38,7 @@ namespace eShopOnContainers.Core.Services.Order
|
|||||||
await _requestProvider.GetAsync<ObservableCollection<Models.Orders.Order>>(uri, token);
|
await _requestProvider.GetAsync<ObservableCollection<Models.Orders.Order>>(uri, token);
|
||||||
|
|
||||||
return orders;
|
return orders;
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return new ObservableCollection<Models.Orders.Order>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Models.Orders.Order> GetOrderAsync(int orderId, string token)
|
public async Task<Models.Orders.Order> GetOrderAsync(int orderId, string token)
|
||||||
|
@ -16,8 +16,7 @@ namespace eShopOnContainers.Core.Services.User
|
|||||||
|
|
||||||
public async Task<UserInfo> GetUserInfoAsync(string authToken)
|
public async Task<UserInfo> GetUserInfoAsync(string authToken)
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.UserInfoEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.UserInfoEndpoint);
|
||||||
|
|
||||||
string uri = builder.ToString();
|
string uri = builder.ToString();
|
||||||
@ -26,11 +25,7 @@ namespace eShopOnContainers.Core.Services.User
|
|||||||
await _requestProvider.GetAsync<UserInfo>(uri, authToken);
|
await _requestProvider.GetAsync<UserInfo>(uri, authToken);
|
||||||
|
|
||||||
return userInfo;
|
return userInfo;
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return new UserInfo();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,22 +7,14 @@ namespace eShopOnContainers.Core.Extensions
|
|||||||
{
|
{
|
||||||
public static ObservableCollection<T> ToObservableCollection<T>(this IEnumerable<T> source)
|
public static ObservableCollection<T> ToObservableCollection<T>(this IEnumerable<T> source)
|
||||||
{
|
{
|
||||||
ObservableCollection<T> collection = new ObservableCollection<T>();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
foreach (T item in source)
|
foreach (T item in source)
|
||||||
{
|
{
|
||||||
collection.Add(item);
|
collection.Add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return collection;
|
return collection;
|
||||||
}
|
|
||||||
// Really?
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return collection;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,8 +21,7 @@ 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)
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
// TODO:
|
// TODO:
|
||||||
UriBuilder builder = new UriBuilder("" /* GlobalSetting.Instance.CatalogEndpoint */);
|
UriBuilder builder = new UriBuilder("" /* GlobalSetting.Instance.CatalogEndpoint */);
|
||||||
|
|
||||||
@ -37,17 +36,13 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
return catalog?.Data.ToObservableCollection();
|
return catalog?.Data.ToObservableCollection();
|
||||||
else
|
else
|
||||||
return new ObservableCollection<CatalogItem>();
|
return new ObservableCollection<CatalogItem>();
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return new ObservableCollection<CatalogItem>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ObservableCollection<CatalogItem>> GetCatalogAsync()
|
public async Task<ObservableCollection<CatalogItem>> GetCatalogAsync()
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
// TODO:
|
// TODO:
|
||||||
UriBuilder builder = new UriBuilder("" /* GlobalSetting.Instance.CatalogEndpoint */);
|
UriBuilder builder = new UriBuilder("" /* GlobalSetting.Instance.CatalogEndpoint */);
|
||||||
|
|
||||||
@ -66,11 +61,7 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
return new ObservableCollection<CatalogItem>();
|
return new ObservableCollection<CatalogItem>();
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return new ObservableCollection<CatalogItem>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<CatalogItem> GetCatalogItemAsync(string id)
|
public Task<CatalogItem> GetCatalogItemAsync(string id)
|
||||||
@ -80,8 +71,7 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
|
|
||||||
public async Task<ObservableCollection<CatalogBrand>> GetCatalogBrandAsync()
|
public async Task<ObservableCollection<CatalogBrand>> GetCatalogBrandAsync()
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
// TODO:
|
// TODO:
|
||||||
UriBuilder builder = new UriBuilder("" /* GlobalSetting.Instance.CatalogEndpoint */);
|
UriBuilder builder = new UriBuilder("" /* GlobalSetting.Instance.CatalogEndpoint */);
|
||||||
|
|
||||||
@ -97,16 +87,10 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
else
|
else
|
||||||
return new ObservableCollection<CatalogBrand>();
|
return new ObservableCollection<CatalogBrand>();
|
||||||
}
|
}
|
||||||
catch
|
|
||||||
{
|
|
||||||
return new ObservableCollection<CatalogBrand>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<ObservableCollection<CatalogType>> GetCatalogTypeAsync()
|
public async Task<ObservableCollection<CatalogType>> GetCatalogTypeAsync()
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
// TODO:
|
// TODO:
|
||||||
UriBuilder builder = new UriBuilder("" /* GlobalSetting.Instance.CatalogEndpoint */);
|
UriBuilder builder = new UriBuilder("" /* GlobalSetting.Instance.CatalogEndpoint */);
|
||||||
|
|
||||||
@ -121,11 +105,7 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
return types.ToObservableCollection();
|
return types.ToObservableCollection();
|
||||||
else
|
else
|
||||||
return new ObservableCollection<CatalogType>();
|
return new ObservableCollection<CatalogType>();
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return new ObservableCollection<CatalogType>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user