Files
Apollon/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs
2022-11-07 16:09:05 +01:00

186 lines
3.2 KiB
C#

using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace Apollon.WPF.ViewModels
{
public class AddEditDetailsViewModel : ViewModelBase
{
private string _organisation;
public string Organisation
{
get
{
return _organisation;
}
set
{
_organisation = value;
OnPropertyChanged(nameof(Organisation));
}
}
private string _tournamentName;
public string TournamentName
{
get
{
return _tournamentName;
}
set
{
_tournamentName = value;
OnPropertyChanged(nameof(TournamentName));
OnPropertyChanged(nameof(CanSubmit));
}
}
private string _competition;
public string Competition
{
get
{
return _competition;
}
set
{
_competition = value;
OnPropertyChanged(nameof(Competition));
}
}
private string _competitionImage;
public string CompetitionImage
{
get
{
return _competitionImage;
}
set
{
_competitionImage = value;
OnPropertyChanged(nameof(CompetitionImage));;
}
}
private DateTime _startDate = DateTime.Today;
public DateTime StartDate
{
get
{
return _startDate;
}
set
{
_startDate = value;
OnPropertyChanged(nameof(StartDate));
}
}
private DateTime _endDate = DateTime.Today;
public DateTime EndDate
{
get
{
return _endDate;
}
set
{
_endDate = value;
OnPropertyChanged(nameof(EndDate));
}
}
private int _rounds;
public int Rounds
{
get
{
return _rounds;
}
set
{
_rounds = value;
OnPropertyChanged(nameof(Rounds));
}
}
private string _location;
public string Location
{
get
{
return _location;
}
set
{
_location = value;
OnPropertyChanged(nameof(Location));
}
}
private bool _isSubmitting;
public bool IsSubmitting
{
get
{
return _isSubmitting;
}
set
{
_isSubmitting = value;
OnPropertyChanged(nameof(IsSubmitting));
}
}
private string _errorMessage;
public string ErrorMessage
{
get
{
return _errorMessage;
}
set
{
_errorMessage = value;
OnPropertyChanged(nameof(ErrorMessage));
OnPropertyChanged(nameof(HasErrorMessage));
}
}
public bool HasErrorMessage => !string.IsNullOrEmpty(ErrorMessage);
public bool CanSubmit => !string.IsNullOrEmpty(TournamentName);
public ICommand SubmitCommand { get; }
public ICommand CancelCommand { get; }
public ObservableCollection<string> CompetitionList { get; set; }
public AddEditDetailsViewModel(ICommand submitCommand, ICommand cancelCommand)
{
SubmitCommand = submitCommand;
CancelCommand = cancelCommand;
CompetitionList = new ObservableCollection<string>
{
"Halle", "im Freien", "Feld", "3D"
};
Competition = CompetitionList[1];
}
}
}