Skip to content

Commit acb45a3

Browse files
committed
2 parents c446af0 + 3e88d94 commit acb45a3

116 files changed

Lines changed: 254 additions & 29579 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cli-linux/prepare-spa-app.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
# Build SPA app
3+
pushd $(pwd)/src/Web/WebSPA
4+
npm rebuild node-sass
5+
#npm run build:prod
6+
7+

docker-compose.ci.build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ services:
66
volumes:
77
- .:/src
88
working_dir: /src
9-
command: /bin/bash -c "dotnet restore ./eShopOnContainers-ServicesAndWebApps.sln && dotnet publish ./eShopOnContainers-ServicesAndWebApps.sln -c Release -o ./obj/Docker/publish"
9+
command: /bin/bash -c "pushd ./src/Web/WebSPA && npm rebuild node-sass && pushd ./../../.. && dotnet restore ./eShopOnContainers-ServicesAndWebApps.sln && dotnet publish ./eShopOnContainers-ServicesAndWebApps.sln -c Release -o ./obj/Docker/publish"
10+

eShopOnContainers-ServicesAndWebApps.sln

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebMVC", "src\Web\WebMVC\We
3838
EndProject
3939
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ordering.Infrastructure", "src\Services\Ordering\Ordering.Infrastructure\Ordering.Infrastructure.csproj", "{95F1F07C-4D92-4742-BD07-E5B805AAB651}"
4040
EndProject
41-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionalTests", "test\Services\FunctionalTests\FunctionalTests.csproj", "{621E7211-58D0-45FD-9600-1CB490BD930E}"
42-
EndProject
4341
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest", "test\Services\UnitTest\UnitTest.csproj", "{7796F5D8-31FC-45A4-B673-19DE5BA194CF}"
4442
EndProject
4543
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Identity.API", "src\Services\Identity\Identity.API\Identity.API.csproj", "{A579E108-5445-403D-A407-339AC4D1611B}"
@@ -48,6 +46,8 @@ Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-co
4846
EndProject
4947
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebSPA", "src\Web\WebSPA\WebSPA.csproj", "{F16E3C6A-1C94-4EAB-BE91-099618060B68}"
5048
EndProject
49+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntegrationTests", "test\Services\IntegrationTests\IntegrationTests.csproj", "{5B810E3D-112E-4857-B197-F09D2FD41E27}"
50+
EndProject
5151
Global
5252
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5353
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
@@ -254,54 +254,6 @@ Global
254254
{95F1F07C-4D92-4742-BD07-E5B805AAB651}.Release|x64.Build.0 = Release|Any CPU
255255
{95F1F07C-4D92-4742-BD07-E5B805AAB651}.Release|x86.ActiveCfg = Release|Any CPU
256256
{95F1F07C-4D92-4742-BD07-E5B805AAB651}.Release|x86.Build.0 = Release|Any CPU
257-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
258-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
259-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
260-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
261-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
262-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
263-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
264-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
265-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
266-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
267-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
268-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
269-
{621E7211-58D0-45FD-9600-1CB490BD930E}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
270-
{621E7211-58D0-45FD-9600-1CB490BD930E}.AppStore|Any CPU.Build.0 = Debug|Any CPU
271-
{621E7211-58D0-45FD-9600-1CB490BD930E}.AppStore|ARM.ActiveCfg = Debug|Any CPU
272-
{621E7211-58D0-45FD-9600-1CB490BD930E}.AppStore|ARM.Build.0 = Debug|Any CPU
273-
{621E7211-58D0-45FD-9600-1CB490BD930E}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
274-
{621E7211-58D0-45FD-9600-1CB490BD930E}.AppStore|iPhone.Build.0 = Debug|Any CPU
275-
{621E7211-58D0-45FD-9600-1CB490BD930E}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
276-
{621E7211-58D0-45FD-9600-1CB490BD930E}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
277-
{621E7211-58D0-45FD-9600-1CB490BD930E}.AppStore|x64.ActiveCfg = Debug|Any CPU
278-
{621E7211-58D0-45FD-9600-1CB490BD930E}.AppStore|x64.Build.0 = Debug|Any CPU
279-
{621E7211-58D0-45FD-9600-1CB490BD930E}.AppStore|x86.ActiveCfg = Debug|Any CPU
280-
{621E7211-58D0-45FD-9600-1CB490BD930E}.AppStore|x86.Build.0 = Debug|Any CPU
281-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
282-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Debug|Any CPU.Build.0 = Debug|Any CPU
283-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Debug|ARM.ActiveCfg = Debug|Any CPU
284-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Debug|ARM.Build.0 = Debug|Any CPU
285-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Debug|iPhone.ActiveCfg = Debug|Any CPU
286-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Debug|iPhone.Build.0 = Debug|Any CPU
287-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
288-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
289-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Debug|x64.ActiveCfg = Debug|Any CPU
290-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Debug|x64.Build.0 = Debug|Any CPU
291-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Debug|x86.ActiveCfg = Debug|Any CPU
292-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Debug|x86.Build.0 = Debug|Any CPU
293-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Release|Any CPU.ActiveCfg = Release|Any CPU
294-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Release|Any CPU.Build.0 = Release|Any CPU
295-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Release|ARM.ActiveCfg = Release|Any CPU
296-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Release|ARM.Build.0 = Release|Any CPU
297-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Release|iPhone.ActiveCfg = Release|Any CPU
298-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Release|iPhone.Build.0 = Release|Any CPU
299-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
300-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
301-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Release|x64.ActiveCfg = Release|Any CPU
302-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Release|x64.Build.0 = Release|Any CPU
303-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Release|x86.ActiveCfg = Release|Any CPU
304-
{621E7211-58D0-45FD-9600-1CB490BD930E}.Release|x86.Build.0 = Release|Any CPU
305257
{7796F5D8-31FC-45A4-B673-19DE5BA194CF}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
306258
{7796F5D8-31FC-45A4-B673-19DE5BA194CF}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
307259
{7796F5D8-31FC-45A4-B673-19DE5BA194CF}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
@@ -494,6 +446,54 @@ Global
494446
{F16E3C6A-1C94-4EAB-BE91-099618060B68}.Release|x64.Build.0 = Release|Any CPU
495447
{F16E3C6A-1C94-4EAB-BE91-099618060B68}.Release|x86.ActiveCfg = Release|Any CPU
496448
{F16E3C6A-1C94-4EAB-BE91-099618060B68}.Release|x86.Build.0 = Release|Any CPU
449+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
450+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
451+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
452+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
453+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
454+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
455+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
456+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
457+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
458+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
459+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
460+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
461+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
462+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.AppStore|Any CPU.Build.0 = Debug|Any CPU
463+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.AppStore|ARM.ActiveCfg = Debug|Any CPU
464+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.AppStore|ARM.Build.0 = Debug|Any CPU
465+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
466+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.AppStore|iPhone.Build.0 = Debug|Any CPU
467+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
468+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
469+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.AppStore|x64.ActiveCfg = Debug|Any CPU
470+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.AppStore|x64.Build.0 = Debug|Any CPU
471+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.AppStore|x86.ActiveCfg = Debug|Any CPU
472+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.AppStore|x86.Build.0 = Debug|Any CPU
473+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
474+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Debug|Any CPU.Build.0 = Debug|Any CPU
475+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Debug|ARM.ActiveCfg = Debug|Any CPU
476+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Debug|ARM.Build.0 = Debug|Any CPU
477+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Debug|iPhone.ActiveCfg = Debug|Any CPU
478+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Debug|iPhone.Build.0 = Debug|Any CPU
479+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
480+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
481+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Debug|x64.ActiveCfg = Debug|Any CPU
482+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Debug|x64.Build.0 = Debug|Any CPU
483+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Debug|x86.ActiveCfg = Debug|Any CPU
484+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Debug|x86.Build.0 = Debug|Any CPU
485+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Release|Any CPU.ActiveCfg = Release|Any CPU
486+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Release|Any CPU.Build.0 = Release|Any CPU
487+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Release|ARM.ActiveCfg = Release|Any CPU
488+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Release|ARM.Build.0 = Release|Any CPU
489+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Release|iPhone.ActiveCfg = Release|Any CPU
490+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Release|iPhone.Build.0 = Release|Any CPU
491+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
492+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
493+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Release|x64.ActiveCfg = Release|Any CPU
494+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Release|x64.Build.0 = Release|Any CPU
495+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Release|x86.ActiveCfg = Release|Any CPU
496+
{5B810E3D-112E-4857-B197-F09D2FD41E27}.Release|x86.Build.0 = Release|Any CPU
497497
EndGlobalSection
498498
GlobalSection(SolutionProperties) = preSolution
499499
HideSolutionNode = FALSE
@@ -512,9 +512,9 @@ Global
512512
{F5598DCB-6DDE-4661-AD9D-A55612DA7E76} = {0BD0DB92-2D98-44D9-9AC0-C59186D59B0B}
513513
{F0333D8E-0B27-42B7-B2C6-78F3657624E2} = {E279BF0F-7F66-4F3A-A3AB-2CDA66C1CD04}
514514
{95F1F07C-4D92-4742-BD07-E5B805AAB651} = {0BD0DB92-2D98-44D9-9AC0-C59186D59B0B}
515-
{621E7211-58D0-45FD-9600-1CB490BD930E} = {EF0337F2-ED00-4643-89FD-EE10863F1870}
516515
{7796F5D8-31FC-45A4-B673-19DE5BA194CF} = {EF0337F2-ED00-4643-89FD-EE10863F1870}
517516
{A579E108-5445-403D-A407-339AC4D1611B} = {24CD3B53-141E-4A07-9B0D-796641E1CF78}
518517
{F16E3C6A-1C94-4EAB-BE91-099618060B68} = {E279BF0F-7F66-4F3A-A3AB-2CDA66C1CD04}
518+
{5B810E3D-112E-4857-B197-F09D2FD41E27} = {EF0337F2-ED00-4643-89FD-EE10863F1870}
519519
EndGlobalSection
520520
EndGlobal

eShopOnContainers.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ordering.Infrastructure", "
6565
EndProject
6666
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Identity", "Identity", "{02DF7FEE-C302-433D-A6CD-237A2569F236}"
6767
EndProject
68-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionalTests", "test\Services\FunctionalTests\FunctionalTests.csproj", "{621E7211-58D0-45FD-9600-1CB490BD930E}"
68+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntegrationTests", "test\Services\IntegrationTests\IntegrationTests.csproj", "{621E7211-58D0-45FD-9600-1CB490BD930E}"
6969
EndProject
7070
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopOnContainers.UITests", "src\Mobile\eShopOnContainers\eShopOnContainers.UITests\eShopOnContainers.UITests.csproj", "{E3B18084-842C-4B80-8E4A-A7E588EC3137}"
7171
EndProject
-2.23 KB
Loading

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Extensions/ObservableExtension.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,13 @@ public static ObservableCollection<T> ToObservableCollection<T>(this IEnumerable
99
{
1010
ObservableCollection<T> collection = new ObservableCollection<T>();
1111

12-
try
12+
foreach (T item in source)
1313
{
14-
foreach (T item in source)
15-
{
16-
collection.Add(item);
17-
}
18-
19-
return collection;
20-
}
21-
catch
22-
{
23-
return collection;
14+
collection.Add(item);
2415
}
16+
17+
return collection;
18+
2519
}
2620
}
2721
}

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Basket/BasketService.cs

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,47 +17,31 @@ public BasketService(IRequestProvider requestProvider)
1717

1818
public async Task<CustomerBasket> GetBasketAsync(string guidUser, string token)
1919
{
20-
try
21-
{
22-
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint);
20+
21+
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint);
2322

24-
builder.Path = guidUser;
23+
builder.Path = guidUser;
2524

26-
string uri = builder.ToString();
25+
string uri = builder.ToString();
26+
27+
CustomerBasket basket =
28+
await _requestProvider.GetAsync<CustomerBasket>(uri, token);
29+
30+
ServicesHelper.FixBasketItemPictureUri(basket?.Items);
31+
32+
return basket;
2733

28-
CustomerBasket basket =
29-
await _requestProvider.GetAsync<CustomerBasket>(uri, token);
30-
31-
ServicesHelper.FixBasketItemPictureUri(basket?.Items);
32-
33-
return basket;
34-
}
35-
catch
36-
{
37-
return new CustomerBasket
38-
{
39-
BuyerId = guidUser,
40-
Items = new System.Collections.Generic.List<BasketItem>()
41-
};
42-
}
4334
}
4435

4536
public async Task<CustomerBasket> UpdateBasketAsync(CustomerBasket customerBasket, string token)
4637
{
47-
try
48-
{
4938
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint);
5039

5140
string uri = builder.ToString();
5241

5342
var result = await _requestProvider.PostAsync(uri, customerBasket, token);
5443

5544
return result;
56-
}
57-
catch
58-
{
59-
return new CustomerBasket();
60-
}
6145
}
6246

6347
public async Task ClearBasketAsync(string guidUser, string token)

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Catalog/CatalogService.cs

Lines changed: 34 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -20,54 +20,44 @@ public CatalogService(IRequestProvider requestProvider)
2020

2121
public async Task<ObservableCollection<CatalogItem>> FilterAsync(int catalogBrandId, int catalogTypeId)
2222
{
23-
try
24-
{
25-
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
2623

27-
builder.Path = string.Format("api/v1/catalog/items/type/{0}/brand/{1}", catalogTypeId, catalogBrandId);
24+
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
2825

29-
string uri = builder.ToString();
26+
builder.Path = string.Format("api/v1/catalog/items/type/{0}/brand/{1}", catalogTypeId, catalogBrandId);
3027

31-
CatalogRoot catalog =
32-
await _requestProvider.GetAsync<CatalogRoot>(uri);
28+
string uri = builder.ToString();
3329

34-
if (catalog?.Data != null)
35-
return catalog?.Data.ToObservableCollection();
36-
else
37-
return new ObservableCollection<CatalogItem>();
38-
}
39-
catch
40-
{
30+
CatalogRoot catalog =
31+
await _requestProvider.GetAsync<CatalogRoot>(uri);
32+
33+
if (catalog?.Data != null)
34+
return catalog?.Data.ToObservableCollection();
35+
else
4136
return new ObservableCollection<CatalogItem>();
42-
}
37+
4338
}
4439

4540
public async Task<ObservableCollection<CatalogItem>> GetCatalogAsync()
4641
{
47-
try
48-
{
49-
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
5042

51-
builder.Path = "api/v1/catalog/items";
43+
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
5244

53-
string uri = builder.ToString();
45+
builder.Path = "api/v1/catalog/items";
5446

55-
CatalogRoot catalog =
56-
await _requestProvider.GetAsync<CatalogRoot>(uri);
47+
string uri = builder.ToString();
5748

58-
if (catalog?.Data != null)
59-
{
60-
ServicesHelper.FixCatalogItemPictureUri(catalog?.Data);
49+
CatalogRoot catalog =
50+
await _requestProvider.GetAsync<CatalogRoot>(uri);
6151

62-
return catalog?.Data.ToObservableCollection();
63-
}
64-
else
65-
return new ObservableCollection<CatalogItem>();
66-
}
67-
catch
52+
if (catalog?.Data != null)
6853
{
69-
return new ObservableCollection<CatalogItem>();
54+
ServicesHelper.FixCatalogItemPictureUri(catalog?.Data);
55+
56+
return catalog?.Data.ToObservableCollection();
7057
}
58+
else
59+
return new ObservableCollection<CatalogItem>();
60+
7161
}
7262

7363
public Task<CatalogItem> GetCatalogItemAsync(string id)
@@ -77,8 +67,7 @@ public Task<CatalogItem> GetCatalogItemAsync(string id)
7767

7868
public async Task<ObservableCollection<CatalogBrand>> GetCatalogBrandAsync()
7969
{
80-
try
81-
{
70+
8271
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
8372

8473
builder.Path = "api/v1/catalog/catalogbrands";
@@ -92,35 +81,26 @@ public async Task<ObservableCollection<CatalogBrand>> GetCatalogBrandAsync()
9281
return brands?.ToObservableCollection();
9382
else
9483
return new ObservableCollection<CatalogBrand>();
95-
}
96-
catch
97-
{
98-
return new ObservableCollection<CatalogBrand>();
99-
}
84+
10085
}
10186

10287
public async Task<ObservableCollection<CatalogType>> GetCatalogTypeAsync()
10388
{
104-
try
105-
{
106-
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
10789

108-
builder.Path = "api/v1/catalog/catalogtypes";
90+
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
10991

110-
string uri = builder.ToString();
92+
builder.Path = "api/v1/catalog/catalogtypes";
11193

112-
IEnumerable<CatalogType> types =
113-
await _requestProvider.GetAsync<IEnumerable<CatalogType>>(uri);
94+
string uri = builder.ToString();
11495

115-
if (types != null)
116-
return types.ToObservableCollection();
117-
else
118-
return new ObservableCollection<CatalogType>();
119-
}
120-
catch
121-
{
96+
IEnumerable<CatalogType> types =
97+
await _requestProvider.GetAsync<IEnumerable<CatalogType>>(uri);
98+
99+
if (types != null)
100+
return types.ToObservableCollection();
101+
else
122102
return new ObservableCollection<CatalogType>();
123-
}
103+
124104
}
125105
}
126106
}

0 commit comments

Comments
 (0)