Exemplo n.º 1
0
        private void UpdateProducts(BldUserReg product)
        {
            var index = Items.IndexOf(product);

            Items.Remove(product);
            Items.Insert(index, product);
        }
        /// <summary>
        /// Adds the todo item async.
        /// </summary>
        /// <returns>The todo item async.</returns>
        /// <param name="itemToAdd">Item to add.</param>
        public async Task <int> AddRegistrationModelAsync(BldUserReg model)
        {
            var data     = JsonConvert.SerializeObject(model);
            var content  = new StringContent(data, Encoding.UTF8, "application/json");
            var response = await client.PostAsync("http://localhost:2998/api/UserReg/item", content);

            var result = JsonConvert.DeserializeObject <int>(response.Content.ReadAsStringAsync().Result);

            return(result);
        }
Exemplo n.º 3
0
        public async Task <bool> RegisterAsync(string userName, string UserAddress, string UserPhoneNo, string UserEmail, string LoginId, string Password)
        {
            var client = new HttpClient();
            var model  = new BldUserReg
            {
                userName    = userName,
                UserAddress = UserAddress,
                UserPhoneNo = UserPhoneNo,
                UserEmail   = UserEmail,
                LoginId     = LoginId,
                Password    = Password
            };
            var         json        = JsonConvert.SerializeObject(model);
            HttpContent httpContent = new StringContent(json);

            httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            var response = await client.PostAsync("http://192.168.15.117:8090/api/BldUserRegs", httpContent);

            return(response.IsSuccessStatusCode);
        }
Exemplo n.º 4
0
        public void ShowOrHidePoducts(BldUserReg product)
        {
            if (_oldProduct == product)
            {
                // click twice on the same item will hide it
                product.IsVisible = !product.IsVisible;
                UpdateProducts(product);
            }
            else
            {
                if (_oldProduct != null)
                {
                    // hide previous selected item
                    _oldProduct.IsVisible = false;
                    UpdateProducts(_oldProduct);
                }
                // show selected item
                product.IsVisible = true;
                UpdateProducts(product);
            }

            _oldProduct = product;
        }