public RentEditWindowViewModel(RentsTabViewModel rentsTabViewModel, RentEditWindow rentEditWindow, Rent rent) : base(rentsTabViewModel, rentEditWindow, rent) { using (var con = new BaudiDbContext()) { OwnershipsList = con.Ownerships.ToList(); if (Update) { Rent = con.Rents.Find(rent.PaymentID); SelectedOwnership = Rent.Ownership; } else { Rent = new Rent(); Rent.Date = DateTime.Now; } } }
/// <summary> /// Edit action /// </summary> public override void Edit() { var rentEditWindow = new RentEditWindow(this, SelectedRent); rentEditWindow.Show(); }
/// <summary> /// Add action /// </summary> public override void Add() { var rentEditWindow = new RentEditWindow(this, null); rentEditWindow.Show(); }