public DetailsProductViewModel() { var ok = new DisplayAlertAction("Ok", async() => { await NavigationService.GoAsync <MainViewModel>(); }); AddToCartCommand = new ViewModelCommand(this, async() => { await DisplayAlertService.DisplayAlertAsync("Products Show Case", $"Product {Product.Name} added successfully", ok); }); }
public ProductsViewModel() { Title = "Products"; RefreshCommand = new ViewModelCommand(this, () => { Products.Add(new Model.Product { Id = Products.Count + 1, Name = DateTime.Now.ToString(), Image = "monkey.png", Price = Products.Count + 1 }); }); AddToCartCommand = new ViewModelCommand <Model.Product>(this, async(product) => { var ok = new DisplayAlertAction("Ok", async() => { await NavigationService.GoAsync <MainViewModel>(); }); await DisplayAlertService.DisplayAlertAsync("Product Show Case", $"Product {product.Name} added successfully", ok); }); }