public PurchaseViewModel(INavigation navigation, ProductsCateg category = null) { _navigation = navigation; Purchase = new Purchase(); //Purchase.UnitsOfProduct = 4; _purchaseRepository = new PurchaseRepository(); _productRepository = new ProductRepository(); PurchasesList = new ObservableCollection <Purchase>(); DrinksPurchasesList = new ObservableCollection <Purchase>(); SnacksPurchasesList = new ObservableCollection <Purchase>(); FoodPurchasesList = new ObservableCollection <Purchase>(); InteriorPurchasesList = new ObservableCollection <Purchase>(); ProductList = new List <Product>(); FinalPurchases = new List <Purchase>(); FoodList = new ObservableCollection <Product>(); SnacksList = new ObservableCollection <Product>(); DrinksList = new ObservableCollection <Product>(); if (category != null) { Category = category.ProdType; } IncreaseUnitsCommand = new Command(async(e) => await IncreaseUnits(e)); DecreaseUnitsCommand = new Command(async(e) => await DecreaseUnits(e)); ContinueToSelectPersCommand = new Command(async() => await ContinueToSelectPers()); DiscardAllCommand = new Command(async() => await DiscardAll()); ChangeCategToDrinksCommand = new Command(async(e) => await ChangeCategToDrinks(e)); ChangeCategToFoodCommand = new Command(async(e) => await ChangeCategToFood(e)); ChangeCategToSnacksCommand = new Command(async(e) => await ChangeCategToSnacks(e)); DrinksPurchasesList.CollectionChanged += DrinksPurchasesList_CollectionChanged; FoodPurchasesList.CollectionChanged += FoodPurchasesList_CollectionChanged; SnacksPurchasesList.CollectionChanged += SnacksPurchasesList_CollectionChanged; PurchasesList.CollectionChanged += PurchasesList_CollectionChanged; }
public PickProductsViewModel(INavigation navigation, ProductsCateg category = null) { _navigation = navigation; _product = new Product(); _productRepository = new ProductRepository(); ProductsList = new ObservableCollection <Product>(); if (category != null) { Category = category.ProdType; viewWithCategory = true; } ViewAllProductsCommand = new Command(async() => await ShowAllProducts(Category)); SaveAndProccedCommand = new Command(async() => await SavePurchasesAndProcced()); AddPurchaseCommand = new Command(async() => await AddPurchaseOrIncreaseQuantity()); DiscardAllCommand = new Command(async() => await DiscardAll()); ChangeCategToDrinksCommand = new Command(async(e) => await ChangeCategToDrinks(e)); ChangeCategToFoodCommand = new Command(async(e) => await ChangeCategToFood(e)); ChangeCategToSnacksCommand = new Command(async(e) => await ChangeCategToSnacks(e)); NavigateToUpdateProdPageCommand = new Command(async(e) => await NavigateToUpdateProdPage(e)); NavigateToDeleteProdPageCommand = new Command(async(e) => await NavigateToDeleteProdPage(e)); }