before migration
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Apollon.Domain\Apollon.Domain.csproj" />
|
||||
<ProjectReference Include="..\Apollon.EntityFramework\Apollon.EntityFramework.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Apollon.WPF
|
||||
public partial class App : Application
|
||||
{
|
||||
private readonly ModalNavigationStore _modalNavigationStore;
|
||||
private readonly TournamentsDBContextFactory _tournamentsDBContextFactory;
|
||||
private readonly TournamentsDbContextFactory _tournamentsDbContextFactory;
|
||||
private readonly IGetAllTournamentsQuery _getAllTournamentQuery;
|
||||
private readonly ICreateTournamentCommand _createTournamentCommand;
|
||||
private readonly IUpdateTournamentCommand _updateTournamentCommand;
|
||||
@@ -34,15 +34,15 @@ namespace Apollon.WPF
|
||||
|
||||
public App()
|
||||
{
|
||||
string connectionString = "Server=NATHALIE-PC\NATLINUXDB;Database=OfficeOrganizer;Trusted_Connection=True;MultipleActiveResultSets=true\";
|
||||
string connectionString = "Data Source=NATHALIE-PC\\NATLINUXDB;Database=Apollon;Trusted_Connection=True;MultipleActiveResultSets=true";
|
||||
|
||||
_modalNavigationStore = new ModalNavigationStore();
|
||||
_tournamentsDBContextFactory = new TournamentsDBContextFactory(
|
||||
_tournamentsDbContextFactory = new TournamentsDbContextFactory(
|
||||
new DbContextOptionsBuilder().UseSqlServer(connectionString).Options);
|
||||
_getAllTournamentQuery = new GetAllTournamentsQuery();
|
||||
_createTournamentCommand = new CreateTournamentCommand();
|
||||
_updateTournamentCommand = new UpdateTournamentCommand();
|
||||
_deleteTournamentCommand = new DeleteTournamentCommand();
|
||||
_getAllTournamentQuery = new GetAllTournamentsQuery(_tournamentsDbContextFactory);
|
||||
_createTournamentCommand = new CreateTournamentCommand(_tournamentsDbContextFactory);
|
||||
_updateTournamentCommand = new UpdateTournamentCommand(_tournamentsDbContextFactory);
|
||||
_deleteTournamentCommand = new DeleteTournamentCommand(_tournamentsDbContextFactory);
|
||||
_tournamentStore = new TournamentsStore(_getAllTournamentQuery, _createTournamentCommand, _updateTournamentCommand, _deleteTournamentCommand);
|
||||
_selectedTournamentStore = new SelectedTournamentsStore(_tournamentStore);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Apollon.Domain.Models;
|
||||
using Apollon.Domain.Commands;
|
||||
using Apollon.Domain.Models;
|
||||
using Apollon.Domain.Queries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -9,16 +11,34 @@ namespace Apollon.WPF.Stores
|
||||
{
|
||||
public class TournamentsStore
|
||||
{
|
||||
private readonly IGetAllTournamentsQuery _getAllTournamentQuery;
|
||||
private readonly ICreateTournamentCommand _createTournamentCommand;
|
||||
private readonly IUpdateTournamentCommand _updateTournamentCommand;
|
||||
private readonly IDeleteTournamentCommand _deleteTournamentCommand;
|
||||
|
||||
public TournamentsStore(IGetAllTournamentsQuery getAllTournamentQuery,
|
||||
ICreateTournamentCommand createTournamentCommand,
|
||||
IUpdateTournamentCommand updateTournamentCommand,
|
||||
IDeleteTournamentCommand deleteTournamentCommand)
|
||||
{
|
||||
_getAllTournamentQuery = getAllTournamentQuery;
|
||||
_createTournamentCommand = createTournamentCommand;
|
||||
_updateTournamentCommand = updateTournamentCommand;
|
||||
_deleteTournamentCommand = deleteTournamentCommand;
|
||||
}
|
||||
|
||||
public event Action<Tournament> TournamentAdded;
|
||||
public event Action<Tournament> TournamentUpdated;
|
||||
|
||||
public async Task Add(Tournament tournament)
|
||||
{
|
||||
await _createTournamentCommand.Execute(tournament);
|
||||
TournamentAdded?.Invoke(tournament);
|
||||
}
|
||||
|
||||
public async Task Update (Tournament tournament)
|
||||
{
|
||||
await _updateTournamentCommand.Execute(tournament);
|
||||
TournamentUpdated?.Invoke(tournament);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user