Edit Modal not Works

This commit is contained in:
Natlinux81
2022-08-16 02:52:01 +02:00
parent a72edbbafd
commit cc060b273a
5 changed files with 20 additions and 15 deletions

View File

@@ -18,7 +18,7 @@ namespace Apollon.WPF
{ {
private readonly ModalNavigationStore _modalNavigationStore; private readonly ModalNavigationStore _modalNavigationStore;
private readonly SelectedTournamentStore _selectedTournamentStore; private readonly SelectedTournamentStore _selectedTournamentStore;
//private readonly Tournament _tournament;
public App() public App()
{ {

View File

@@ -12,15 +12,17 @@ namespace Apollon.WPF.Commands
public class OpenEditTournamentCommand : CommandBase public class OpenEditTournamentCommand : CommandBase
{ {
private readonly ModalNavigationStore _modalNavigationStore; private readonly ModalNavigationStore _modalNavigationStore;
private readonly Tournament _tournament;
public OpenEditTournamentCommand(ModalNavigationStore modalNavigationStore) public OpenEditTournamentCommand(ModalNavigationStore modalNavigationStore, Tournament tournament)
{ {
_modalNavigationStore = modalNavigationStore; _modalNavigationStore = modalNavigationStore;
_tournament = tournament;
} }
public override void Execute(object parameter) public override void Execute(object parameter)
{ {
EditTournamentViewModel editTournamentViewModel = new EditTournamentViewModel(_modalNavigationStore); EditTournamentViewModel editTournamentViewModel = new EditTournamentViewModel(_modalNavigationStore, _tournament);
_modalNavigationStore.CurrentViewModel = editTournamentViewModel; _modalNavigationStore.CurrentViewModel = editTournamentViewModel;
} }
} }

View File

@@ -14,19 +14,19 @@ namespace Apollon.WPF.ViewModels
{ {
public AddEditDetailsViewModel AddEditDetailsViewModel { get; } public AddEditDetailsViewModel AddEditDetailsViewModel { get; }
public EditTournamentViewModel(ModalNavigationStore modalNavigationStore) public EditTournamentViewModel(ModalNavigationStore modalNavigationStore, Tournament tournament)
{ {
ICommand submitCommand = new EditTournamentCommand(modalNavigationStore); ICommand submitCommand = new EditTournamentCommand(modalNavigationStore);
ICommand cancelCommand = new CloseModalCommand(modalNavigationStore); ICommand cancelCommand = new CloseModalCommand(modalNavigationStore);
AddEditDetailsViewModel = new AddEditDetailsViewModel(submitCommand, cancelCommand ) AddEditDetailsViewModel = new AddEditDetailsViewModel(submitCommand, cancelCommand )
{ {
//Organisation = tournament.Organisation, Organisation = tournament.Organisation,
//Tournamentname = tournament.Tournamentname, Tournamentname = tournament.Tournamentname,
//Category = tournament.Category, Category = tournament.Category,
//Startdate = tournament.Startdate, Startdate = tournament.Startdate,
//Enddate = tournament.Enddate, Enddate = tournament.Enddate,
//Location = tournament.Location, Location = tournament.Location,
//Rounds = tournament.Rounds, Rounds = tournament.Rounds,
}; };
} }
} }

View File

@@ -48,7 +48,10 @@ namespace Apollon.WPF.ViewModels
} }
private void AddTournament(Tournament tournament, ModalNavigationStore modalNavigationStore) private void AddTournament(Tournament tournament, ModalNavigationStore modalNavigationStore)
{ {
_overviewListingItemViewModels.Add(new OverviewListingItemViewModel(tournament)); ICommand editTournamentCommand = new OpenAddTournamentCommand(modalNavigationStore);
_overviewListingItemViewModels.Add(new OverviewListingItemViewModel(tournament
//,editTournamentCommand
));
} }
} }

View File

@@ -26,7 +26,7 @@ namespace Apollon.WPF.ViewModels
OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore); OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore);
AddTournamentCommand = new OpenAddTournamentCommand(modalNavigationStore); AddTournamentCommand = new OpenAddTournamentCommand(modalNavigationStore);
EditTournamentCommand = new OpenEditTournamentCommand(modalNavigationStore); //EditTournamentCommand = new OpenEditTournamentCommand(modalNavigationStore);
} }
} }
} }