/// <summary> /// Initializes a new instance of the <see cref="MachineFamilyVM"/> class. /// </summary> /// <param name="entity">The entity.</param> /// <param name="access"></param> /// <param name="dataService"></param> public MachineFamilyVM(MachineFamily entity, AccessType access, MachineFamilyDataService dataService) : base(access) { InitializeData(dataService); _model = entity; Machines = new ObservableCollection<Machine>(); foreach (Machine product in entity.Machines) { Machines.Add(product); } }
private void FixupMachineFamily(MachineFamily previousValue) { if (previousValue != null && previousValue.Machines.Contains(this)) { previousValue.Machines.Remove(this); } if (MachineFamily != null) { if (!MachineFamily.Machines.Contains(this)) { MachineFamily.Machines.Add(this); } } }
public override void Save(object param) { MachineFamilyDataService.AttachModel(_model); _model = MachineFamilyDataService.GetSingle(_model.Id); OnPropertyChanged("ModifiedBy");OnPropertyChanged("ModifiedDate");Mode = ModificationStatus.Saved; }