diff --git a/Apollon.WPF/Apollon.WPF.csproj b/Apollon.WPF/Apollon.WPF.csproj index 145af72..2f5c264 100644 --- a/Apollon.WPF/Apollon.WPF.csproj +++ b/Apollon.WPF/Apollon.WPF.csproj @@ -3,7 +3,7 @@ WinExe net6.0-windows - disable + enable true diff --git a/Apollon.WPF/Commands/AddTournamentCommand.cs b/Apollon.WPF/Commands/AddTournamentCommand.cs index c864485..3763635 100644 --- a/Apollon.WPF/Commands/AddTournamentCommand.cs +++ b/Apollon.WPF/Commands/AddTournamentCommand.cs @@ -32,7 +32,7 @@ namespace Apollon.WPF.Commands public override async Task ExecuteAsync(object parameter) { AddEditDetailsViewModel formViewModel = _addTournamentViewModel.AddEditDetailsViewModel; - Tournament tournament = new Tournament(formViewModel.Organisation,formViewModel.Tournamentname, formViewModel.Competition, formViewModel.Startdate, formViewModel.Enddate, + Tournament tournament = new Tournament(formViewModel.Organisation,formViewModel.TournamentName, formViewModel.Competition, formViewModel.StartDate, formViewModel.EndDate, formViewModel.Location, formViewModel.Rounds); try diff --git a/Apollon.WPF/Models/Tournament.cs b/Apollon.WPF/Models/Tournament.cs index c82b1b7..d6fe055 100644 --- a/Apollon.WPF/Models/Tournament.cs +++ b/Apollon.WPF/Models/Tournament.cs @@ -8,22 +8,22 @@ namespace Apollon.WPF.Models { public class Tournament { - public Tournament(string organisation, string tournamentname, string competition, string startdate, string enddate, string location, int rounds = 0) + public Tournament(string organisation, string tournamentName, string competition, DateTime startDate, DateTime endDate, string location, int rounds = 0) { Organisation = organisation; - Tournamentname = tournamentname; + TournamentName = tournamentName; Competition = competition; - Startdate = startdate; - Enddate = enddate; + StartDate = startDate; + EndDate = endDate; Location = location; Rounds = rounds; } public string Organisation { get; } - public string Tournamentname { get; } + public string TournamentName { get; } public string Competition { get; } - public string Startdate { get; } - public string Enddate { get; } + public DateTime StartDate { get; } + public DateTime EndDate { get; } public string Location { get; } public int Rounds { get; } diff --git a/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs b/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs index 36bcccd..d6a7f03 100644 --- a/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs +++ b/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs @@ -22,18 +22,19 @@ namespace Apollon.WPF.ViewModels OnPropertyChanged(nameof(Organisation)); } } + - private string _tournamentname; - public string Tournamentname + private string _tournamentName; + public string TournamentName { get { - return _tournamentname; + return _tournamentName; } set { - _tournamentname = value; - OnPropertyChanged(nameof(Tournamentname)); + _tournamentName = value; + OnPropertyChanged(nameof(TournamentName)); OnPropertyChanged(nameof(CanSubmit)); } } @@ -52,31 +53,37 @@ namespace Apollon.WPF.ViewModels } } - private string _startdate; - public string Startdate + private DateTime _startDate = DateTime.Today; + + + + public DateTime StartDate { + get { - return _startdate; + + return _startDate; } set { - _startdate = value; - OnPropertyChanged(nameof(Startdate)); + _startDate = value; + + OnPropertyChanged(nameof(StartDate)); } } - private string _enddate; - public string Enddate + private DateTime _endDate = DateTime.Today; + public DateTime EndDate { get { - return _enddate; + return _endDate; } set { - _enddate = value; - OnPropertyChanged(nameof(Enddate)); + _endDate = value; + OnPropertyChanged(nameof(EndDate)); } } @@ -108,7 +115,7 @@ namespace Apollon.WPF.ViewModels } } - public bool CanSubmit => !string.IsNullOrEmpty(Tournamentname); + public bool CanSubmit => !string.IsNullOrEmpty(TournamentName); public ICommand SubmitCommand { get; } public ICommand CancelCommand { get; } diff --git a/Apollon.WPF/ViewModels/EditTournamentViewModel.cs b/Apollon.WPF/ViewModels/EditTournamentViewModel.cs index 1e2be97..fa3d01f 100644 --- a/Apollon.WPF/ViewModels/EditTournamentViewModel.cs +++ b/Apollon.WPF/ViewModels/EditTournamentViewModel.cs @@ -21,10 +21,10 @@ namespace Apollon.WPF.ViewModels AddEditDetailsViewModel = new AddEditDetailsViewModel(submitCommand, cancelCommand ) { Organisation = tournament.Organisation, - Tournamentname = tournament.Tournamentname, + TournamentName = tournament.TournamentName, Competition = tournament.Competition, - Startdate = tournament.Startdate, - Enddate = tournament.Enddate, + StartDate = tournament.StartDate, + EndDate = tournament.EndDate, Location = tournament.Location, Rounds = tournament.Rounds, }; diff --git a/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs b/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs index ba7e89e..a92dc5f 100644 --- a/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs +++ b/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs @@ -16,10 +16,10 @@ namespace Apollon.WPF.ViewModels public bool HasSelectedTournament => SelectedTournament != null; public string Organisation => SelectedTournament?.Organisation ?? "keine Organisation"; - public string Tournamentname => SelectedTournament?.Tournamentname ?? "kein Name"; + public string TournamentName => SelectedTournament?.TournamentName ?? "kein Name"; public string Category => SelectedTournament?.Competition ?? "keine Kategorie"; - public string Startdate => SelectedTournament?.Startdate ?? "kein Datum"; - public string Enddate => SelectedTournament?.Enddate ?? "kein Datum"; + 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"; public int Rounds => SelectedTournament?.Rounds ?? 0; @@ -40,10 +40,10 @@ namespace Apollon.WPF.ViewModels { OnPropertyChanged(nameof(HasSelectedTournament)); OnPropertyChanged(nameof(Organisation)); - OnPropertyChanged(nameof(Tournamentname)); + OnPropertyChanged(nameof(TournamentName)); OnPropertyChanged(nameof(Category)); - OnPropertyChanged(nameof(Startdate)); - OnPropertyChanged(nameof(Enddate)); + OnPropertyChanged(nameof(StartDate)); + OnPropertyChanged(nameof(EndDate)); OnPropertyChanged(nameof(Location)); OnPropertyChanged(nameof(Rounds)); } diff --git a/Apollon.WPF/ViewModels/OverviewListingItemViewModel.cs b/Apollon.WPF/ViewModels/OverviewListingItemViewModel.cs index 57ade72..0cd48b5 100644 --- a/Apollon.WPF/ViewModels/OverviewListingItemViewModel.cs +++ b/Apollon.WPF/ViewModels/OverviewListingItemViewModel.cs @@ -12,7 +12,7 @@ namespace Apollon.WPF.ViewModels { public Tournament Tournament { get;} - public string Tournamentname => Tournament.Tournamentname; + public string TournamentName => Tournament.TournamentName; public string Location => Tournament.Location; public ICommand DeleteCommand { get; } diff --git a/Apollon.WPF/Views/Components/AddEditDetails.xaml b/Apollon.WPF/Views/Components/AddEditDetails.xaml index 322dd7c..0c1b09e 100644 --- a/Apollon.WPF/Views/Components/AddEditDetails.xaml +++ b/Apollon.WPF/Views/Components/AddEditDetails.xaml @@ -51,7 +51,7 @@ VerticalContentAlignment="Center"/> - - - diff --git a/Apollon.WPF/Views/Components/OverviewDetails.xaml b/Apollon.WPF/Views/Components/OverviewDetails.xaml index 5c2964a..c9ecb30 100644 --- a/Apollon.WPF/Views/Components/OverviewDetails.xaml +++ b/Apollon.WPF/Views/Components/OverviewDetails.xaml @@ -34,7 +34,7 @@ - - - - - - - - - + -