public OwnershipEditWindowViewModel(OwnershipsTabViewModel ownershipTabViewModel, OwnershipEditWindow ownershipEditWindow, Ownership ownership) : base(ownershipTabViewModel, ownershipEditWindow, ownership) { using (var con = new BaudiDbContext()) { LocalsList = con.Locals.ToList(); OwnersList = con.Owners.ToList(); if (Update) { Ownership = con.Ownerships.Find(ownership.OwnershipID); SelectedLocal = Ownership.Local; SelectedOwner = Ownership.Owner; } else { Ownership = new Ownership(); Ownership.PurchaseDate = DateTime.Now; } } }
/// <summary> /// Constructor /// </summary> /// <param name="ownershipsTabViewModel">Ownerships tab view model</param> /// <param name="ownership">Ownership</param> public OwnershipEditWindow(OwnershipsTabViewModel ownershipsTabViewModel, Ownership ownership) { InitializeComponent(); DataContext = new OwnershipEditWindowViewModel(ownershipsTabViewModel, this, ownership); }