add competition Image to Database
This commit is contained in:
@@ -7,26 +7,29 @@ using System.Threading.Tasks;
|
|||||||
namespace Apollon.Domain.Models
|
namespace Apollon.Domain.Models
|
||||||
{
|
{
|
||||||
public class Tournament
|
public class Tournament
|
||||||
{
|
{
|
||||||
public Guid Id { get; }
|
public Tournament(Guid id, string organisation, string tournamentName, string competition, string competitionImage, DateTime startDate, DateTime endDate, string location, int rounds)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
Organisation = organisation;
|
Organisation = organisation;
|
||||||
TournamentName = tournamentName;
|
TournamentName = tournamentName;
|
||||||
Competition = competition;
|
Competition = competition;
|
||||||
|
CompetitionImage = competitionImage;
|
||||||
StartDate = startDate;
|
StartDate = startDate;
|
||||||
EndDate = endDate;
|
EndDate = endDate;
|
||||||
Location = location;
|
Location = location;
|
||||||
Rounds = rounds;
|
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; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ namespace Apollon.EntityFramework.Commands
|
|||||||
Id = tournament.Id,
|
Id = tournament.Id,
|
||||||
Organisation = tournament.Organisation,
|
Organisation = tournament.Organisation,
|
||||||
TournamentName = tournament.TournamentName,
|
TournamentName = tournament.TournamentName,
|
||||||
Competition = tournament.Competition,
|
Competition = tournament.Competition,
|
||||||
|
CompetitionImage = tournament.CompetitionImage,
|
||||||
StartDate = tournament.StartDate,
|
StartDate = tournament.StartDate,
|
||||||
EndDate = tournament.EndDate,
|
EndDate = tournament.EndDate,
|
||||||
Location = tournament.Location,
|
Location = tournament.Location,
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace Apollon.EntityFramework.Commands
|
|||||||
Organisation = tournament.Organisation,
|
Organisation = tournament.Organisation,
|
||||||
TournamentName = tournament.TournamentName,
|
TournamentName = tournament.TournamentName,
|
||||||
Competition = tournament.Competition,
|
Competition = tournament.Competition,
|
||||||
|
CompetitionImage = tournament.CompetitionImage,
|
||||||
StartDate = tournament.StartDate,
|
StartDate = tournament.StartDate,
|
||||||
EndDate = tournament.EndDate,
|
EndDate = tournament.EndDate,
|
||||||
Location = tournament.Location,
|
Location = tournament.Location,
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ namespace Apollon.EntityFramework.DTOs
|
|||||||
public string Organisation { get; set; }
|
public string Organisation { get; set; }
|
||||||
public string TournamentName { get; set; }
|
public string TournamentName { get; set; }
|
||||||
public string Competition { get; set; }
|
public string Competition { get; set; }
|
||||||
|
public string CompetitionImage { get; set; }
|
||||||
public DateTime StartDate { get; set; }
|
public DateTime StartDate { get; set; }
|
||||||
public DateTime EndDate { get; set; }
|
public DateTime EndDate { get; set; }
|
||||||
public string Location { get; set; }
|
public string Location { get; set; }
|
||||||
|
|||||||
64
Apollon.EntityFramework/Migrations/20220828165744_initial1.Designer.cs
generated
Normal file
64
Apollon.EntityFramework/Migrations/20220828165744_initial1.Designer.cs
generated
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,6 +31,9 @@ namespace Apollon.EntityFramework.Migrations
|
|||||||
b.Property<string>("Competition")
|
b.Property<string>("Competition")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("CompetitionImage")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<DateTime>("EndDate")
|
b.Property<DateTime>("EndDate")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ namespace Apollon.EntityFramework.Queries
|
|||||||
y.Organisation,
|
y.Organisation,
|
||||||
y.TournamentName,
|
y.TournamentName,
|
||||||
y.Competition,
|
y.Competition,
|
||||||
|
y.CompetitionImage,
|
||||||
y.StartDate,
|
y.StartDate,
|
||||||
y.EndDate,
|
y.EndDate,
|
||||||
y.Location,
|
y.Location,
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ namespace Apollon.WPF.Commands
|
|||||||
detailsViewModel.Organisation,
|
detailsViewModel.Organisation,
|
||||||
detailsViewModel.TournamentName,
|
detailsViewModel.TournamentName,
|
||||||
detailsViewModel.Competition,
|
detailsViewModel.Competition,
|
||||||
|
detailsViewModel.CompetitionImage,
|
||||||
detailsViewModel.StartDate,
|
detailsViewModel.StartDate,
|
||||||
detailsViewModel.EndDate,
|
detailsViewModel.EndDate,
|
||||||
detailsViewModel.Location,
|
detailsViewModel.Location,
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ namespace Apollon.WPF.Commands
|
|||||||
detailsViewModel.Organisation,
|
detailsViewModel.Organisation,
|
||||||
detailsViewModel.TournamentName,
|
detailsViewModel.TournamentName,
|
||||||
detailsViewModel.Competition,
|
detailsViewModel.Competition,
|
||||||
|
detailsViewModel.CompetitionImage,
|
||||||
detailsViewModel.StartDate,
|
detailsViewModel.StartDate,
|
||||||
detailsViewModel.EndDate,
|
detailsViewModel.EndDate,
|
||||||
detailsViewModel.Location,
|
detailsViewModel.Location,
|
||||||
|
|||||||
@@ -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;
|
private DateTime _startDate = DateTime.Today;
|
||||||
public DateTime StartDate
|
public DateTime StartDate
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace Apollon.WPF.ViewModels
|
|||||||
{
|
{
|
||||||
Organisation = tournament.Organisation,
|
Organisation = tournament.Organisation,
|
||||||
TournamentName = tournament.TournamentName,
|
TournamentName = tournament.TournamentName,
|
||||||
Competition = tournament.Competition,
|
Competition = tournament.Competition,
|
||||||
StartDate = tournament.StartDate,
|
StartDate = tournament.StartDate,
|
||||||
EndDate = tournament.EndDate,
|
EndDate = tournament.EndDate,
|
||||||
Location = tournament.Location,
|
Location = tournament.Location,
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ namespace Apollon.WPF.ViewModels
|
|||||||
public string Organisation => SelectedTournament?.Organisation ?? "keine Organisation";
|
public string Organisation => SelectedTournament?.Organisation ?? "keine Organisation";
|
||||||
public string TournamentName => SelectedTournament?.TournamentName ?? "kein Name";
|
public string TournamentName => SelectedTournament?.TournamentName ?? "kein Name";
|
||||||
public string Competition => SelectedTournament?.Competition ?? "keine Kategorie";
|
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 StartDate => SelectedTournament?.StartDate.ToString("d") ?? "kein Datum";
|
||||||
public string EndDate => SelectedTournament?.EndDate.ToString("d") ?? "kein Datum";
|
public string EndDate => SelectedTournament?.EndDate.ToString("d") ?? "kein Datum";
|
||||||
public string Location => SelectedTournament?.Location ?? "kein Ort";
|
public string Location => SelectedTournament?.Location ?? "kein Ort";
|
||||||
@@ -43,6 +44,7 @@ namespace Apollon.WPF.ViewModels
|
|||||||
OnPropertyChanged(nameof(Organisation));
|
OnPropertyChanged(nameof(Organisation));
|
||||||
OnPropertyChanged(nameof(TournamentName));
|
OnPropertyChanged(nameof(TournamentName));
|
||||||
OnPropertyChanged(nameof(Competition));
|
OnPropertyChanged(nameof(Competition));
|
||||||
|
OnPropertyChanged(nameof(CompetitionImage));
|
||||||
OnPropertyChanged(nameof(StartDate));
|
OnPropertyChanged(nameof(StartDate));
|
||||||
OnPropertyChanged(nameof(EndDate));
|
OnPropertyChanged(nameof(EndDate));
|
||||||
OnPropertyChanged(nameof(Location));
|
OnPropertyChanged(nameof(Location));
|
||||||
|
|||||||
Reference in New Issue
Block a user