public GenreWrapper(dic_Genre g) { if (g == null) { dicGenre = new dic_Genre(); return; } dicGenre = g; Name = g.name; GenreDescription = g.genre_description; }
public async Task Load() { dic_Genre generalGenre = new dic_Genre(); generalGenre.name = "All/Any"; dic_Product_type generalProductType = new dic_Product_type(); generalProductType.name = "All/Any"; dic_condition generalCondition = new dic_condition(); generalCondition.name = "All/Any"; using (var client = new HttpClient()) { URLBuilder url = new URLBuilder("/api/Dictionary/"); var request = new HttpRequestMessage() { RequestUri = new Uri(url.URL), Method = HttpMethod.Get, }; var response = await client.SendAsync(request); var contents = await response.Content.ReadAsStringAsync(); if (!response.IsSuccessStatusCode) { return; } DictionaryDto result = JsonConvert.DeserializeObject <DictionaryDto>(contents); IEnumerable <GenreDto> genres = result.Genres; Genres.Add(new GenreWrapper(generalGenre)); foreach (GenreDto g in genres) { GenreWrapper wrap = g.createGenre(); Genres.Add(wrap); } IEnumerable <ConditionDto> conditions = result.Conditions; Conditions.Add(new ConditionWrapper(generalCondition)); foreach (ConditionDto c in conditions) { Conditions.Add(c.createCondition()); } IEnumerable <ProductTypeDto> productTypes = result.ProductTypes; ProductTypes.Add(new ProductTypeWrapper(generalProductType)); foreach (var p in productTypes) { ProductTypes.Add(p.createProductType()); } } }
public FilterViewModel() { dic_Genre dicGenre = new dic_Genre(); dic_condition dicCondition = new dic_condition(); dicGenre.name = "All/Any"; dicCondition.name = "All/Any"; _genre = new GenreWrapper(dicGenre); _condition = new ConditionWrapper(dicCondition); _name = ""; _price = "100"; _rating = "1"; _stock = "1"; }
public void clear() { dic_Genre dicGenre = new dic_Genre(); dic_Product_type dicProductType = new dic_Product_type(); dic_condition dicCondition = new dic_condition(); dicGenre.name = "All/Any"; dicCondition.name = "All/Any"; dicProductType.name = "All/Any"; _productType = new ProductTypeWrapper(dicProductType); _genre = new GenreWrapper(dicGenre); _condition = new ConditionWrapper(dicCondition); _name = ""; Price = ""; _rating = ""; _stock = ""; _productOwner = null; _soldCopies = null; _id = null; _buyerId = null; _sellerId = null; _amount = null; }