コード例 #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);
        }