コード例 #1
0
        private async void BtnAddToCart_Clicked(object sender, EventArgs e)
        {
            try
            {
                var addToCart = new AddToCart();
                addToCart.Price       = LblPrice.Text;
                addToCart.Qty         = LblQty.Text;
                addToCart.TotalAmount = LblTotalPrice.Text;
                addToCart.ProductId   = productId;
                addToCart.CustomerId  = Preferences.Get("userId", 0);
                var response = await ApiService.AddItemsInCart(addToCart);

                if (response)
                {
                    await DisplayAlert("Done", "Item added to the Cart", "Alright");
                }
                else
                {
                    await DisplayAlert("Oops", "Something gone Wrong", "Cancel");
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("warning", ex.Message.ToString(), "Cancel");
            }

            await Navigation.PopModalAsync();
        }
コード例 #2
0
        private async void BtnAddToCart_Clicked(object sender, EventArgs e)
        {
            var addToCart = new AddToCart();

            addToCart.Qty         = LblQty.Text;
            addToCart.Price       = LblPrice.Text;
            addToCart.TotalAmount = LblTotalPrice.Text;
            addToCart.ProductId   = _productId;
            addToCart.CustomerId  = Preferences.Get("userId", 0);

            var response = await ApiService.AddItemsInCart(addToCart);

            if (response)
            {
                await DisplayAlert("", "Your items has been added to the cart", "Alright");
            }
            else
            {
                await DisplayAlert("Oops", "Something went wrong", "Cancel");
            }
        }
コード例 #3
0
        private async void BtnAddToCart_Clicked(object sender, EventArgs e)
        {
            var addToCart = new AddToCart();

            addToCart.Qty         = LblQty.Text;
            addToCart.Price       = LblPrice.Text;
            addToCart.TotalAmount = LblTotalPrice.Text;
            addToCart.ProductId   = _productId;
            addToCart.CustomerId  = Preferences.Get("userId", 0);

            var response = await ApiService.AddItemsInCart(addToCart);

            if (!response)
            {
                await DisplayAlert("Oops", "Qualcosa è andato storto, prova tra poco", "Cancella");
            }
            else
            {
                await DisplayAlert("Carrello aggiornato", "Il prodotto è stato aggiunto al carrello!", "Continua");
            }
        }
コード例 #4
0
        private async void BtnAddToCart_Clicked(object sender, EventArgs e)
        {
            var addToCart = new AddToCart();

            addToCart.Qty         = LblQty.Text;
            addToCart.Price       = LblPrice.Text;
            addToCart.TotalAmount = LblTotalPrice.Text;
            addToCart.ProductId   = _productId;
            addToCart.CustomerId  = Preferences.Get("userId", 0);

            var response = await ApiService.AddItemsInCart(addToCart);

            if (response)
            {
                await DisplayAlert("", "Se ha añadido al Carrito de Compra", "Aceptar");
            }
            else
            {
                await DisplayAlert("Oops", "Algo salio mal", "Cancelar");
            }
        }
コード例 #5
0
        private async void TapAddToCart_Tapped(object sender, EventArgs e)
        {
            var addToCart = new AddToCart()
            {
                Qty        = Convert.ToInt32(LblQty.Text),
                Price      = Convert.ToInt32(LblPrice.Text),
                ProductId  = _productId,
                CustomerId = Preferences.Get("userId", 0)
            };

            var response = await ApiService.AddItemsInCart(addToCart);

            if (response)
            {
                await DisplayAlert("", "Your item has been added to the cart", "Alright");
            }
            else
            {
                await DisplayAlert("Oops", "Something went wrong", "Cancel");
            }
        }