Exemple #1
0
        private async void BtnAddToCart_Clicked(object sender, EventArgs e)
        {
            var addToCart = new AddToCart
            {
                CustomerId  = Preferences.Get("userId", 0),
                Price       = LblPrice.Text,
                TotalAmount = LblTotalPrice.Text,
                ProductId   = _productId,
                Qty         = LblQty.Text
            };

            var result = await _service.AddItemInCart(addToCart);

            if (result)
            {
                await DisplayAlert("", $"{LblName.Text} added to your cart.", "Alright");
            }
            else
            {
                await DisplayAlert("Ooops", "Someting went wrong.", "Alright");
            }
        }