public OrderTypeEditWindowViewModel(OrderTypesTabViewModel orderTypeTabViewModel, OrderTypeEditWindow orderTypeEditWindow, OrderType orderType) : base(orderTypeTabViewModel, orderTypeEditWindow, orderType) { using (var con = new BaudiDbContext()) { SpecializationList = con.Specializations.ToList(); if (Update) { OrderType = con.OrderTypes.Find(orderType.OrderTypeID); OrderType.Specializations.ForEach(s => s.IsSelected = true); } else { OrderType = new OrderType(); } } }
/// <summary> /// Constructor /// </summary> /// <param name="orderTypesTabViewModel">Order types tab view model</param> /// <param name="orderType">Order type</param> public OrderTypeEditWindow(OrderTypesTabViewModel orderTypesTabViewModel, OrderType orderType) { InitializeComponent(); DataContext = new OrderTypeEditWindowViewModel(orderTypesTabViewModel, this, orderType); }