예제 #1
0
        internal void UpdateGadget(GadgetViewModel editGadgetViewModel)
        {
            var existingGadget = Gadgets.FirstOrDefault(g => g.InventoryNumber == editGadgetViewModel.InventoryNumber);

            if (existingGadget != null)
            {
                existingGadget.Name         = editGadgetViewModel.Name;
                existingGadget.Condition    = editGadgetViewModel.Condition;
                existingGadget.Price        = editGadgetViewModel.Price;
                existingGadget.Manufacturer = editGadgetViewModel.Manufacturer;

                dataService.UpdateGadget(editGadgetViewModel.Data);
            }
        }
예제 #2
0
        public EditGadgetViewModel(MainWindowViewModel mainWindowViewModel)
        {
            _mainWindowViewModel = mainWindowViewModel;

            _gadget = new GadgetViewModel(_mainWindowViewModel.SelectedGadget.Data);
        }