public TrancportInfoViewModel(Trancport trancport, IObjectSetValue window) { _window = window; if (trancport.Id > 0) { EditableTrancport = TinyMapper.Map <Trancport>(trancport); } else { EditableTrancport = new Trancport(); } _trancport = trancport; _models = TracnportInformation.Info.Models; Makes = new ObservableCollection <MakeTrancport>(TracnportInformation.Info.Makes); Categories = new ObservableCollection <TrancportCategory>(TracnportInformation.Info.Categories); TrancportTypes = new ObservableCollection <TrancportType>(TracnportInformation.Info.Types); EngineTypes = new ObservableCollection <EngineType>(TracnportInformation.Info.EngineTypes); MakeTrancport = EditableTrancport?.Make?.Name; // hack crazy }
public ContractorInfoViewModel(IContractor contractor, IObjectSetValue window) { _window = window; if (contractor.Id > 0) { IsNew = Visibility.Hidden; EditableContractor = TinyMapper.Map <IContractor>(contractor); _contractor = contractor; } else { IsNew = Visibility.Visible; EditableContractor = new Contractor() { City = new City(), Region = new Region() }; } _Settings(); }