finish delete Modal
This commit is contained in:
@@ -13,11 +13,13 @@ namespace Apollon.WPF.Commands
|
||||
{
|
||||
private readonly OverviewListingItemViewModel _overviewListingItemViewModel;
|
||||
private readonly TournamentsStore _tournamentStore;
|
||||
private readonly ModalNavigationStore _modalNavigationStore;
|
||||
|
||||
public DeleteTournamentCommand(OverviewListingItemViewModel overviewListingItemViewModel, TournamentsStore tournamentStore)
|
||||
public DeleteTournamentCommand(OverviewListingItemViewModel overviewListingItemViewModel, TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore)
|
||||
{
|
||||
_overviewListingItemViewModel = overviewListingItemViewModel;
|
||||
_tournamentStore = tournamentStore;
|
||||
_tournamentStore = tournamentStore;
|
||||
_modalNavigationStore = modalNavigationStore;
|
||||
}
|
||||
|
||||
public override async Task ExecuteAsync(object parameter)
|
||||
@@ -27,6 +29,8 @@ namespace Apollon.WPF.Commands
|
||||
try
|
||||
{
|
||||
await _tournamentStore.Delete(tournament.Id);
|
||||
|
||||
_modalNavigationStore.Close();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Apollon.WPF.Stores;
|
||||
using Apollon.Domain.Models;
|
||||
using Apollon.WPF.Stores;
|
||||
using Apollon.WPF.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -10,16 +11,21 @@ namespace Apollon.WPF.Commands
|
||||
{
|
||||
public class OpenWarningDeleteCommand : CommandBase
|
||||
{
|
||||
private readonly OverviewListingItemViewModel _overviewListingItemViewModel;
|
||||
private readonly ModalNavigationStore _modalNavigationStore;
|
||||
private readonly TournamentsStore _tournamentsStore;
|
||||
|
||||
public OpenWarningDeleteCommand(ModalNavigationStore modalNavigationStore)
|
||||
public OpenWarningDeleteCommand(OverviewListingItemViewModel overviewListingItemViewModel, ModalNavigationStore modalNavigationStore, TournamentsStore tournamentsStore)
|
||||
{
|
||||
_overviewListingItemViewModel = overviewListingItemViewModel;
|
||||
_modalNavigationStore = modalNavigationStore;
|
||||
_tournamentsStore = tournamentsStore;
|
||||
}
|
||||
|
||||
public override void Execute(object parameter)
|
||||
{
|
||||
WarningDeleteViewModel warningDeleteViewModel = new WarningDeleteViewModel(_modalNavigationStore);
|
||||
Tournament tournament =_overviewListingItemViewModel.Tournament;
|
||||
WarningDeleteViewModel warningDeleteViewModel = new WarningDeleteViewModel(_modalNavigationStore,_tournamentsStore,_overviewListingItemViewModel);
|
||||
_modalNavigationStore.CurrentViewModel = warningDeleteViewModel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Apollon.WPF.ViewModels
|
||||
|
||||
EditCommand = new OpenEditTournamentCommand(this, tournamentStore, modalNavigationStore);
|
||||
//DeleteCommand = new DeleteTournamentCommand(this, tournamentStore);
|
||||
WarningDeleteCommand = new OpenWarningDeleteCommand(modalNavigationStore);
|
||||
WarningDeleteCommand = new OpenWarningDeleteCommand(this, modalNavigationStore, tournamentStore);
|
||||
}
|
||||
|
||||
public void Update(Tournament tournament)
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
using Apollon.WPF.Stores;
|
||||
using Apollon.WPF.Commands;
|
||||
using Apollon.WPF.Stores;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Apollon.WPF.ViewModels
|
||||
{
|
||||
public class WarningDeleteViewModel : ViewModelBase
|
||||
{
|
||||
public WarningDeleteViewModel(ModalNavigationStore modalNavigationStore)
|
||||
public ICommand WarningCloseCommand { get;}
|
||||
public ICommand DeleteCommand { get; }
|
||||
public WarningDeleteViewModel(ModalNavigationStore modalNavigationStore,TournamentsStore tournamentsStore, OverviewListingItemViewModel overviewListingItemViewModel)
|
||||
{
|
||||
WarningCloseCommand = new CloseModalCommand(modalNavigationStore);
|
||||
DeleteCommand = new DeleteTournamentCommand(overviewListingItemViewModel, tournamentsStore, modalNavigationStore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
<Button Grid.Column="1"
|
||||
Content="Abbrechen"
|
||||
Command="{Binding CancelCommand}"
|
||||
Command="{Binding WarningCloseCommand}"
|
||||
Style="{StaticResource ModernButton}"
|
||||
Width="100"
|
||||
Height="30"
|
||||
|
||||
Reference in New Issue
Block a user