Example #1
0
        public async void AddToCart(object o, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(this.quantityEntry.Text))
            {
                await DisplayAlert("Add to cart", "Please enter quantity", "Ok");
            }
            else
            {
                await DisplayAlert("Add to cart", "Success", "Ok");

                this.quantity = Int32.Parse(this.quantityEntry.Text);
                CartViewModel cvm = new CartViewModel();
                await cvm.CreateCart(new Model.Cart {
                    ProductId = this.product.ProductId, Quantity = quantity, UserId = userId
                });
            }
        }