submit Add and Edit Command
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using Apollon.WPF.Stores;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Apollon.WPF.Commands
|
||||
{
|
||||
public class AddTournamentCommand : AsyncCommandBase
|
||||
{
|
||||
private readonly ModalNavigationStore _modalNavigationStore;
|
||||
|
||||
public AddTournamentCommand(ModalNavigationStore modalNavigationStore)
|
||||
{
|
||||
_modalNavigationStore = modalNavigationStore;
|
||||
}
|
||||
|
||||
public override async Task ExecuteAsync(object parameter)
|
||||
{
|
||||
// Add Tournament to Database
|
||||
|
||||
_modalNavigationStore.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Apollon.WPF.Commands
|
||||
{
|
||||
public abstract class AsyncCommandBase : CommandBase
|
||||
{
|
||||
public override async void Execute(object parameter)
|
||||
{
|
||||
try
|
||||
{
|
||||
await ExecuteAsync(parameter);
|
||||
}
|
||||
catch (Exception) { }
|
||||
|
||||
}
|
||||
|
||||
public abstract Task ExecuteAsync(object parameter);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using Apollon.WPF.Stores;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Apollon.WPF.Commands
|
||||
{
|
||||
public class EditTournamentCommand : AsyncCommandBase
|
||||
{
|
||||
private readonly ModalNavigationStore _modalNavigationStore;
|
||||
|
||||
public EditTournamentCommand(ModalNavigationStore modalNavigationStore)
|
||||
{
|
||||
_modalNavigationStore = modalNavigationStore;
|
||||
}
|
||||
|
||||
public override async Task ExecuteAsync(object parameter)
|
||||
{
|
||||
// Edit Tournament to Database
|
||||
|
||||
_modalNavigationStore.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,18 +11,16 @@ namespace Apollon.WPF.Commands
|
||||
{
|
||||
public class OpenEditTournamentCommand : CommandBase
|
||||
{
|
||||
private readonly ModalNavigationStore _modalNavigationStore;
|
||||
private readonly Tournament _tournament;
|
||||
private readonly ModalNavigationStore _modalNavigationStore;
|
||||
|
||||
public OpenEditTournamentCommand(ModalNavigationStore modalNavigationStore, Tournament tournament)
|
||||
public OpenEditTournamentCommand(ModalNavigationStore modalNavigationStore)
|
||||
{
|
||||
_modalNavigationStore = modalNavigationStore;
|
||||
_tournament = tournament;
|
||||
_modalNavigationStore = modalNavigationStore;
|
||||
}
|
||||
|
||||
public override void Execute(object parameter)
|
||||
{
|
||||
EditTournamentViewModel editTournamentViewModel = new EditTournamentViewModel(_tournament,_modalNavigationStore);
|
||||
EditTournamentViewModel editTournamentViewModel = new EditTournamentViewModel(_modalNavigationStore);
|
||||
_modalNavigationStore.CurrentViewModel = editTournamentViewModel;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user