@@ -20,7 +20,6 @@ public CatalogService(IRequestProvider requestProvider)
2020
2121 public async Task < ObservableCollection < CatalogItem > > FilterAsync ( int catalogBrandId , int catalogTypeId )
2222 {
23-
2423 UriBuilder builder = new UriBuilder ( GlobalSetting . Instance . CatalogEndpoint ) ;
2524
2625 builder . Path = string . Format ( "api/v1/catalog/items/type/{0}/brand/{1}" , catalogTypeId , catalogBrandId ) ;
@@ -34,12 +33,10 @@ public async Task<ObservableCollection<CatalogItem>> FilterAsync(int catalogBran
3433 return catalog ? . Data . ToObservableCollection ( ) ;
3534 else
3635 return new ObservableCollection < CatalogItem > ( ) ;
37-
3836 }
3937
4038 public async Task < ObservableCollection < CatalogItem > > GetCatalogAsync ( )
4139 {
42-
4340 UriBuilder builder = new UriBuilder ( GlobalSetting . Instance . CatalogEndpoint ) ;
4441
4542 builder . Path = "api/v1/catalog/items" ;
@@ -56,32 +53,28 @@ public async Task<ObservableCollection<CatalogItem>> GetCatalogAsync()
5653 return catalog ? . Data . ToObservableCollection ( ) ;
5754 }
5855 else
59- return new ObservableCollection < CatalogItem > ( ) ;
60-
56+ return new ObservableCollection < CatalogItem > ( ) ;
6157 }
6258
6359 public async Task < ObservableCollection < CatalogBrand > > GetCatalogBrandAsync ( )
6460 {
61+ UriBuilder builder = new UriBuilder ( GlobalSetting . Instance . CatalogEndpoint ) ;
6562
66- UriBuilder builder = new UriBuilder ( GlobalSetting . Instance . CatalogEndpoint ) ;
67-
68- builder . Path = "api/v1/catalog/catalogbrands" ;
69-
70- string uri = builder . ToString ( ) ;
63+ builder . Path = "api/v1/catalog/catalogbrands" ;
7164
72- IEnumerable < CatalogBrand > brands =
73- await _requestProvider . GetAsync < IEnumerable < CatalogBrand > > ( uri ) ;
65+ string uri = builder . ToString ( ) ;
7466
75- if ( brands != null )
76- return brands ? . ToObservableCollection ( ) ;
77- else
78- return new ObservableCollection < CatalogBrand > ( ) ;
67+ IEnumerable < CatalogBrand > brands =
68+ await _requestProvider . GetAsync < IEnumerable < CatalogBrand > > ( uri ) ;
7969
70+ if ( brands != null )
71+ return brands ? . ToObservableCollection ( ) ;
72+ else
73+ return new ObservableCollection < CatalogBrand > ( ) ;
8074 }
8175
8276 public async Task < ObservableCollection < CatalogType > > GetCatalogTypeAsync ( )
8377 {
84-
8578 UriBuilder builder = new UriBuilder ( GlobalSetting . Instance . CatalogEndpoint ) ;
8679
8780 builder . Path = "api/v1/catalog/catalogtypes" ;
@@ -94,8 +87,7 @@ public async Task<ObservableCollection<CatalogType>> GetCatalogTypeAsync()
9487 if ( types != null )
9588 return types . ToObservableCollection ( ) ;
9689 else
97- return new ObservableCollection < CatalogType > ( ) ;
98-
90+ return new ObservableCollection < CatalogType > ( ) ;
9991 }
10092 }
10193}
0 commit comments