Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Margo.Data;
- using Margo.UI.Utilities;
- using System;
- using System.Data;
- namespace Margo.UI.ViewModel
- {
- public class ShoppingListViewModel : BaseViewModel
- {
- private DataAccess _dataAccess = new DataAccess();
- private DataTable _shoppingList;
- public BaseViewModel ViewModel { get; set; }
- public DataTable ShoppingList
- {
- get { return _shoppingList; }
- private set
- {
- _shoppingList = value;
- OnPropertyChanged(nameof(ShoppingList));
- }
- }
- public RelayCommand AddProductCommand { get; private set; }
- public ShoppingListViewModel()
- {
- _dataAccess.ConnectToDatabase();
- ShoppingList = _dataAccess.ShoppingList;
- AddProductCommand = new RelayCommand(OnAddProduct);
- }
- public event Action AddProductRequested = delegate { };
- private void OnAddProduct()
- {
- AddProductRequested();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement