public static void SaveSnackMachine(Model.SnackMachine machine) { using (ISession session = SessionFactory.OpenSession()) { using (ITransaction transaction = session.BeginTransaction()) { session.SaveOrUpdate(machine); transaction.Commit(); } } }
public SnackMachineViewModel(Model.SnackMachine snackMachine) { _snackMachine = snackMachine; InsertFiveCentCommand = new Command(() => InsertMoney(Model.Money.FiveCent)); InsertTenCentCommand = new Command(() => InsertMoney(Model.Money.TenCent)); InsertDollarCommand = new Command(() => InsertMoney(Model.Money.Dollar)); InsertFiveDollarCommand = new Command(() => InsertMoney(Model.Money.FiveDollar)); BuySnackCommand = new Command(() => BuySnack()); ReturnMoneyCommand = new Command(() => ReturnMoney()); }