diff --git a/Apollon.Domain/Models/Tournament.cs b/Apollon.Domain/Models/Tournament.cs index 76b89a9..b380897 100644 --- a/Apollon.Domain/Models/Tournament.cs +++ b/Apollon.Domain/Models/Tournament.cs @@ -7,26 +7,29 @@ using System.Threading.Tasks; namespace Apollon.Domain.Models { public class Tournament - { - public Guid Id { get; } - public string Organisation { get; } - public string TournamentName { get; } - public string Competition { get; } - public DateTime StartDate { get; } - public DateTime EndDate { get; } - public string Location { get; } - public int Rounds { get; } - - public Tournament(Guid id, string organisation, string tournamentName, string competition, DateTime startDate, DateTime endDate, string location, int rounds = 0) + { + public Tournament(Guid id, string organisation, string tournamentName, string competition, string competitionImage, DateTime startDate, DateTime endDate, string location, int rounds) { Id = id; Organisation = organisation; TournamentName = tournamentName; Competition = competition; + CompetitionImage = competitionImage; StartDate = startDate; EndDate = endDate; Location = location; Rounds = rounds; } + + public Guid Id { get; } + public string Organisation { get; } + public string TournamentName { get; } + public string Competition { get; } + public string CompetitionImage { get; } + public DateTime StartDate { get; } + public DateTime EndDate { get; } + public string Location { get; } + public int Rounds { get; } + } } diff --git a/Apollon.EntityFramework/Commands/CreateTournamentCommand.cs b/Apollon.EntityFramework/Commands/CreateTournamentCommand.cs index 8f92275..5bda453 100644 --- a/Apollon.EntityFramework/Commands/CreateTournamentCommand.cs +++ b/Apollon.EntityFramework/Commands/CreateTournamentCommand.cs @@ -28,7 +28,8 @@ namespace Apollon.EntityFramework.Commands Id = tournament.Id, Organisation = tournament.Organisation, TournamentName = tournament.TournamentName, - Competition = tournament.Competition, + Competition = tournament.Competition, + CompetitionImage = tournament.CompetitionImage, StartDate = tournament.StartDate, EndDate = tournament.EndDate, Location = tournament.Location, diff --git a/Apollon.EntityFramework/Commands/UpdateTournamentCommand.cs b/Apollon.EntityFramework/Commands/UpdateTournamentCommand.cs index a46473e..338be09 100644 --- a/Apollon.EntityFramework/Commands/UpdateTournamentCommand.cs +++ b/Apollon.EntityFramework/Commands/UpdateTournamentCommand.cs @@ -28,6 +28,7 @@ namespace Apollon.EntityFramework.Commands Organisation = tournament.Organisation, TournamentName = tournament.TournamentName, Competition = tournament.Competition, + CompetitionImage = tournament.CompetitionImage, StartDate = tournament.StartDate, EndDate = tournament.EndDate, Location = tournament.Location, diff --git a/Apollon.EntityFramework/DTOs/TournamentDto.cs b/Apollon.EntityFramework/DTOs/TournamentDto.cs index ce4602b..d51cd03 100644 --- a/Apollon.EntityFramework/DTOs/TournamentDto.cs +++ b/Apollon.EntityFramework/DTOs/TournamentDto.cs @@ -12,6 +12,7 @@ namespace Apollon.EntityFramework.DTOs public string Organisation { get; set; } public string TournamentName { get; set; } public string Competition { get; set; } + public string CompetitionImage { get; set; } public DateTime StartDate { get; set; } public DateTime EndDate { get; set; } public string Location { get; set; } diff --git a/Apollon.EntityFramework/Migrations/20220828165744_initial1.Designer.cs b/Apollon.EntityFramework/Migrations/20220828165744_initial1.Designer.cs new file mode 100644 index 0000000..60cb82d --- /dev/null +++ b/Apollon.EntityFramework/Migrations/20220828165744_initial1.Designer.cs @@ -0,0 +1,64 @@ +// +using System; +using Apollon.EntityFramework; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Apollon.EntityFramework.Migrations +{ + [DbContext(typeof(TournamentsDbContext))] + [Migration("20220828165744_initial1")] + partial class initial1 + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("Apollon.EntityFramework.DTOs.TournamentDto", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Competition") + .HasColumnType("nvarchar(max)"); + + b.Property("CompetitionImage") + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("Location") + .HasColumnType("nvarchar(max)"); + + b.Property("Organisation") + .HasColumnType("nvarchar(max)"); + + b.Property("Rounds") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("TournamentName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Tournaments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Apollon.EntityFramework/Migrations/20220828165744_initial1.cs b/Apollon.EntityFramework/Migrations/20220828165744_initial1.cs new file mode 100644 index 0000000..a9f79d8 --- /dev/null +++ b/Apollon.EntityFramework/Migrations/20220828165744_initial1.cs @@ -0,0 +1,25 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Apollon.EntityFramework.Migrations +{ + public partial class initial1 : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "CompetitionImage", + table: "Tournaments", + type: "nvarchar(max)", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "CompetitionImage", + table: "Tournaments"); + } + } +} diff --git a/Apollon.EntityFramework/Migrations/TournamentsDbContextModelSnapshot.cs b/Apollon.EntityFramework/Migrations/TournamentsDbContextModelSnapshot.cs index 2207312..022de9b 100644 --- a/Apollon.EntityFramework/Migrations/TournamentsDbContextModelSnapshot.cs +++ b/Apollon.EntityFramework/Migrations/TournamentsDbContextModelSnapshot.cs @@ -31,6 +31,9 @@ namespace Apollon.EntityFramework.Migrations b.Property("Competition") .HasColumnType("nvarchar(max)"); + b.Property("CompetitionImage") + .HasColumnType("nvarchar(max)"); + b.Property("EndDate") .HasColumnType("datetime2"); diff --git a/Apollon.EntityFramework/Queries/GetAllTournamentsQuery.cs b/Apollon.EntityFramework/Queries/GetAllTournamentsQuery.cs index 318b65a..5494ec3 100644 --- a/Apollon.EntityFramework/Queries/GetAllTournamentsQuery.cs +++ b/Apollon.EntityFramework/Queries/GetAllTournamentsQuery.cs @@ -30,6 +30,7 @@ namespace Apollon.EntityFramework.Queries y.Organisation, y.TournamentName, y.Competition, + y.CompetitionImage, y.StartDate, y.EndDate, y.Location, diff --git a/Apollon.WPF/Commands/AddTournamentCommand.cs b/Apollon.WPF/Commands/AddTournamentCommand.cs index 26230be..b64f879 100644 --- a/Apollon.WPF/Commands/AddTournamentCommand.cs +++ b/Apollon.WPF/Commands/AddTournamentCommand.cs @@ -39,6 +39,7 @@ namespace Apollon.WPF.Commands detailsViewModel.Organisation, detailsViewModel.TournamentName, detailsViewModel.Competition, + detailsViewModel.CompetitionImage, detailsViewModel.StartDate, detailsViewModel.EndDate, detailsViewModel.Location, diff --git a/Apollon.WPF/Commands/EditTournamentCommand.cs b/Apollon.WPF/Commands/EditTournamentCommand.cs index aea09c3..6231603 100644 --- a/Apollon.WPF/Commands/EditTournamentCommand.cs +++ b/Apollon.WPF/Commands/EditTournamentCommand.cs @@ -33,6 +33,7 @@ namespace Apollon.WPF.Commands detailsViewModel.Organisation, detailsViewModel.TournamentName, detailsViewModel.Competition, + detailsViewModel.CompetitionImage, detailsViewModel.StartDate, detailsViewModel.EndDate, detailsViewModel.Location, diff --git a/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs b/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs index 4ec5ada..7078853 100644 --- a/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs +++ b/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs @@ -52,6 +52,20 @@ namespace Apollon.WPF.ViewModels } } + private string _competitionImage; + public string CompetitionImage + { + get + { + return _competitionImage; + } + set + { + _competitionImage = value; + OnPropertyChanged(nameof(CompetitionImage)); + } + } + private DateTime _startDate = DateTime.Today; public DateTime StartDate { diff --git a/Apollon.WPF/ViewModels/EditTournamentViewModel.cs b/Apollon.WPF/ViewModels/EditTournamentViewModel.cs index 18ea5de..0323660 100644 --- a/Apollon.WPF/ViewModels/EditTournamentViewModel.cs +++ b/Apollon.WPF/ViewModels/EditTournamentViewModel.cs @@ -26,7 +26,7 @@ namespace Apollon.WPF.ViewModels { Organisation = tournament.Organisation, TournamentName = tournament.TournamentName, - Competition = tournament.Competition, + Competition = tournament.Competition, StartDate = tournament.StartDate, EndDate = tournament.EndDate, Location = tournament.Location, diff --git a/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs b/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs index 6ee62bc..05e19d6 100644 --- a/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs +++ b/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs @@ -17,6 +17,7 @@ namespace Apollon.WPF.ViewModels public string Organisation => SelectedTournament?.Organisation ?? "keine Organisation"; public string TournamentName => SelectedTournament?.TournamentName ?? "kein Name"; public string Competition => SelectedTournament?.Competition ?? "keine Kategorie"; + public string CompetitionImage => SelectedTournament?.CompetitionImage ?? "kein Bild"; public string StartDate => SelectedTournament?.StartDate.ToString("d") ?? "kein Datum"; public string EndDate => SelectedTournament?.EndDate.ToString("d") ?? "kein Datum"; public string Location => SelectedTournament?.Location ?? "kein Ort"; @@ -43,6 +44,7 @@ namespace Apollon.WPF.ViewModels OnPropertyChanged(nameof(Organisation)); OnPropertyChanged(nameof(TournamentName)); OnPropertyChanged(nameof(Competition)); + OnPropertyChanged(nameof(CompetitionImage)); OnPropertyChanged(nameof(StartDate)); OnPropertyChanged(nameof(EndDate)); OnPropertyChanged(nameof(Location));