Esempio n. 1
0
        public GenreWrapper createGenre()
        {
            GenreWrapper genre = new GenreWrapper(new LGSA.Model.dic_Genre());

            genre.GenreDescription = this.Description;
            genre.Id   = this.Id;
            genre.Name = this.Name;
            return(genre);
        }
Esempio n. 2
0
        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;
        }