add competition Image to Database

This commit is contained in:
Natlinux81
2022-08-28 19:03:24 +02:00
parent dfe0f72d04
commit bbf1e21fdf
13 changed files with 130 additions and 13 deletions

View File

@@ -8,25 +8,28 @@ 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; }
}
}

View File

@@ -29,6 +29,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,

View File

@@ -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,

View File

@@ -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; }

View File

@@ -0,0 +1,64 @@
// <auto-generated />
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<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Competition")
.HasColumnType("nvarchar(max)");
b.Property<string>("CompetitionImage")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("EndDate")
.HasColumnType("datetime2");
b.Property<string>("Location")
.HasColumnType("nvarchar(max)");
b.Property<string>("Organisation")
.HasColumnType("nvarchar(max)");
b.Property<int>("Rounds")
.HasColumnType("int");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<string>("TournamentName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Tournaments");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -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<string>(
name: "CompetitionImage",
table: "Tournaments",
type: "nvarchar(max)",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CompetitionImage",
table: "Tournaments");
}
}
}

View File

@@ -31,6 +31,9 @@ namespace Apollon.EntityFramework.Migrations
b.Property<string>("Competition")
.HasColumnType("nvarchar(max)");
b.Property<string>("CompetitionImage")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("EndDate")
.HasColumnType("datetime2");

View File

@@ -30,6 +30,7 @@ namespace Apollon.EntityFramework.Queries
y.Organisation,
y.TournamentName,
y.Competition,
y.CompetitionImage,
y.StartDate,
y.EndDate,
y.Location,

View File

@@ -39,6 +39,7 @@ namespace Apollon.WPF.Commands
detailsViewModel.Organisation,
detailsViewModel.TournamentName,
detailsViewModel.Competition,
detailsViewModel.CompetitionImage,
detailsViewModel.StartDate,
detailsViewModel.EndDate,
detailsViewModel.Location,

View File

@@ -33,6 +33,7 @@ namespace Apollon.WPF.Commands
detailsViewModel.Organisation,
detailsViewModel.TournamentName,
detailsViewModel.Competition,
detailsViewModel.CompetitionImage,
detailsViewModel.StartDate,
detailsViewModel.EndDate,
detailsViewModel.Location,

View File

@@ -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
{

View File

@@ -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));