Esempio n. 1
0
 public ProductsCRUDViewModel(ProductsAndCost productsAndCost)
 {
     IsEnabled            = false;
     CurrentProduct       = new Product();
     CurrentProductCost   = new ProductCost();
     DeleteProductCommand = new Command(async() => await DeleteProduct());
     UpdateProductCommand = new Command(async() => await UpdateProduct());
     SaveTappedCommand    = new Command(async() => await SaveProduct());
     ClearTappedCommand   = new Command(async() => await ClearEdits(productsAndCost));
     GetProductCommand    = new Command(async() => await GetProduct(productsAndCost.CurrentProduct.ProductId));
     GetProductCommand.Execute(new Command(async() => await GetProduct(productsAndCost.CurrentProduct.ProductId)));
     GetProductCostCommand = new Command(async() => await GetProductCost(productsAndCost.CurrentProductCost.ProductId));
     GetProductCostCommand.Execute(new Command(async() => await GetProductCost(productsAndCost.CurrentProductCost.ProductId)));
 }
Esempio n. 2
0
 public ProductDetails(ProductsAndCost productsAndCost)
 {
     InitializeComponent();
     BindingContext = new ProductsCRUDViewModel(productsAndCost);
 }
Esempio n. 3
0
        private async Task ClearEdits(ProductsAndCost productsAndCost)
        {
            CurrentProduct = await App.Database.GetProductAsync(productsAndCost.CurrentProduct.ProductId);

            CurrentProductCost = await App.Database.GetProductCostAsync(productsAndCost.CurrentProduct.ProductId);
        }