Exemplo n.º 1
0
        private void setBodySizes()
        {
            if (this.ProductProperties == null)
            {
                throw new Exception("No Product Property");
            }
            var list = new List <long>();

            foreach (var item in this.ProductProperties)
            {
                if (item.ProductSizeId == null)
                {
                    continue;
                }
                if (list.Contains((long)item.ProductSizeId))
                {
                    continue;
                }
                list.Add((long)item.ProductSizeId);
            }

            var sizes = new List <ProductSize>();

            foreach (var item in list)
            {
                var result = _productPropertyApi.GetSize(item);
                sizes.Add(JObjectToObject.Convert <ProductSize>(result.Data));
            }

            this.AvailableSizes = sizes;
        }
Exemplo n.º 2
0
        private void setAvailableProducts()
        {
            if (this.ProductProperties == null)
            {
                throw new Exception("No Product Property");
            }
            var list = new List <long>();

            foreach (var item in this.ProductProperties)
            {
                if (item.ProductColorId == null)
                {
                    continue;
                }
                if (list.Contains((long)item.ProductColorId))
                {
                    continue;
                }
                list.Add((long)item.ProductColorId);
            }

            var colors = new List <ProductColor>();

            foreach (var item in list)
            {
                var result = _productPropertyApi.GetColor(item);
                colors.Add(JObjectToObject.Convert <ProductColor>(result.Data));
            }

            this.AvailableColors = colors;
        }
Exemplo n.º 3
0
        private async Task <string> Login(string username, string password)
        {
            if (string.IsNullOrWhiteSpace(username))
            {
                return(null);
            }
            var payload = new
            {
                Username = username,
                Password = password
            };
            var response = await PostAsync("user/authenticate", payload);

            if (response != null && response.Data != null)
            {
                var data = JObjectToObject.Convert <LoginResult>(response.Data);
                //var data = response.Data as LoginResult;
                return(data.Token);
            }
            else
            {
                return(null);
            }
        }