private void ButtonUpdateProperty_Click(object sender, RoutedEventArgs e) { if (PropertiesDataGrid.SelectedItem is PropertyDTO selectedProperty) { var copy = new PropertyDTO(selectedProperty); var window = new CRUPropertyWindow(copy, CRUMode.Update); var result = window.ShowDialog(); if (result.HasValue && result.Value) { dataProvider.UpdateProperty(copy); RefreshProperties(); } } }
private void ButtonCreateProperty_Click(object sender, RoutedEventArgs e) { if (LandlordsDataGrid.SelectedItem is LandlordDTO selectedLandlord) { var newProperty = new PropertyDTO(selectedLandlord.Id); var window = new CRUPropertyWindow(newProperty, CRUMode.Create); var result = window.ShowDialog(); if (result.HasValue && result.Value) { dataProvider.CreateProperty(newProperty); RefreshProperties(); } } }