public EquipmentEditViewModel(EquipmentListViewModel viewModel, Entities database)
        {
            _database  = database;
            _viewModel = viewModel;

            Equipment      = viewModel.SelectedEquipment;
            EquipmentImage = viewModel.SelectedEquipment.Image;
            EquipmentTypes = database.Categories.ToList();

            SaveCommand        = new RelayCommand(Save);
            CancelCommand      = new RelayCommand(Cancel);
            SelectImageCommand = new RelayCommand(SelectImage);
        }
Esempio n. 2
0
        public EquipmentCreateViewModel(EquipmentListViewModel viewModel, Entities database)
        {
            _database  = database;
            _viewModel = viewModel;

            Equipment      = new Data.Equipment();
            EquipmentTypes = database.Categories.ToList();

            SaveCommand        = new RelayCommand(Save);
            CancelCommand      = new RelayCommand(Cancel);
            SelectImageCommand = new RelayCommand(SelectImage);

            Equipment.Name     = "New Item";
            Equipment.Category = EquipmentTypes.First();
            Equipment.Value    = 1;
        }