Add a Tournament
This commit is contained in:
@@ -32,22 +32,26 @@ namespace Apollon.WPF.Commands
|
||||
public override async Task ExecuteAsync(object parameter)
|
||||
{
|
||||
AddEditDetailsViewModel formViewModel = _addTournamentViewModel.AddEditDetailsViewModel;
|
||||
Tournament tournament = new Tournament(formViewModel.Organisation,formViewModel.TournamentName, formViewModel.Competition, formViewModel.StartDate, formViewModel.EndDate,
|
||||
formViewModel.Location, formViewModel.Rounds);
|
||||
Tournament tournament = new Tournament(
|
||||
formViewModel.Organisation,
|
||||
formViewModel.TournamentName,
|
||||
formViewModel.Competition,
|
||||
formViewModel.StartDate,
|
||||
formViewModel.EndDate,
|
||||
formViewModel.Location,
|
||||
formViewModel.Rounds);
|
||||
|
||||
try
|
||||
{
|
||||
await _tournamentStore.Add(tournament);
|
||||
|
||||
_modalNavigationStore.Close();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
// Add Tournament to Database
|
||||
|
||||
|
||||
_modalNavigationStore.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,16 +45,21 @@ namespace Apollon.WPF.ViewModels
|
||||
_modalNavigationStore = modalNavigationStore;
|
||||
_overviewListingItemViewModels = new ObservableCollection<OverviewListingItemViewModel>();
|
||||
|
||||
//_overviewListingItemViewModels.Add(new OverviewListingItemViewModel(new Tournament("DSB", "Meisterschaft", "Halle", DateTime.Now, DateTime.Now, "Bruchsal", 10)));
|
||||
|
||||
|
||||
//AddTournament(new Tournament("DSB", "Deutschemeisterschaft1", "Halle", "01.01.2021", "05.01.2021", "Wiesbaden",3),modalNavigationStore);
|
||||
//AddTournament(new Tournament("DSB", "Deutschemeisterschaft2", "im Freien", "01.01.2021", "05.01.2021", "Berlin",5),modalNavigationStore);
|
||||
AddTournament(new Tournament("DSB", "Deutschemeisterschaft3", "Halle", DateTime.Now, DateTime.Today, "Bruchsal", 6), modalNavigationStore);
|
||||
|
||||
_tournamentStore.TournamentAdded += TournamentStore_TournamentAdded;
|
||||
}
|
||||
|
||||
private void AddTournament(Tournament tournament, ModalNavigationStore modalNavigationStore)
|
||||
protected override void Dispose()
|
||||
{
|
||||
_tournamentStore.TournamentAdded -= TournamentStore_TournamentAdded;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
private void TournamentStore_TournamentAdded(Tournament tournament)
|
||||
{
|
||||
AddTournament(tournament);
|
||||
}
|
||||
|
||||
private void AddTournament(Tournament tournament)
|
||||
{
|
||||
// TO DO EditTournamentCommand
|
||||
_overviewListingItemViewModels.Add(new OverviewListingItemViewModel(tournament));
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Apollon.WPF.ViewModels
|
||||
public OverviewDetailsViewModel OverviewDetailsViewModel{ get; }
|
||||
|
||||
public ICommand AddTournamentCommand { get; }
|
||||
public ICommand EditTournamentCommand { get; set ; }
|
||||
public ICommand EditTournamentCommand { get;}
|
||||
|
||||
|
||||
|
||||
@@ -28,12 +28,6 @@ namespace Apollon.WPF.ViewModels
|
||||
AddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore);
|
||||
EditTournamentCommand = new OpenEditTournamentCommand(modalNavigationStore);
|
||||
|
||||
AddTournament(new Tournament("DSB", "Deutschemeisterschaft3", "Halle", DateTime.Now, DateTime.Today, "Bruchsal", 6), modalNavigationStore);
|
||||
}
|
||||
|
||||
private void AddTournament(Tournament tournament, ModalNavigationStore modalNavigationStore)
|
||||
{
|
||||
ICommand editTournamentCommand = new EditTournamentCommand(modalNavigationStore);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user