Ejemplo n.º 1
0
        public void CreateCottager(Cottager cottager, Garden garden)
        {
            cottager.Id = _UnitOfWork.CottagerDAO.GetNextId();

            garden.Id = _UnitOfWork.GardenDAO.GetNextId();

            cottager.GardenId = garden.Id;
            
            _UnitOfWork.CottagerDAO.create(cottager);
        }
Ejemplo n.º 2
0
        private void DoAddCmd()
        {
            Cottager cottager = new Cottager();
            Garden newGarden = new Garden();
            cottager.Garden = newGarden;

            EditCottagerView editView = new EditCottagerView();
            EditCottagerViewModel editViewModel = new EditCottagerViewModel(cottager, editView);
            editView.DataContext = editViewModel;

            editView.ShowDialog();

            if (editView.DialogResult.HasValue && editView.DialogResult.Value)
            {
                cottager.MonthId = _selectedMonthId;
                _PumpStationBL.CreateCottager(cottager, newGarden);
                _UnitOfWork.Commit();

                RefreshList(_selectedMonthId);
            }

        }