public void FillScoring(ChampionshipDto championshipDto, ChampionshipCreationViewModel championshipCreationViewModel) { championshipDto.Scoring = championshipCreationViewModel.SessionsDefinitionViewModel.SessionsDefinitions.Select(x => new ScoringDto() { Scoring = x.Scoring.ToList(), }).ToList(); }
public void OpenChampionshipCreationDialog(Action <ChampionshipDto> newChampionshipCallback, Action cancellationCallback) { _newChampionshipCallback = newChampionshipCallback; _cancellationCallback = cancellationCallback; _championshipCreationViewModel = _viewModelFactory.Create <ChampionshipCreationViewModel>(); _championshipCreationViewModel.IsSimulatorSelectionEnabled = true; _championshipCreationViewModel.AvailableSimulators = SimulatorRatingControllerFactory.SupportedSimulators; _championshipCreationViewModel.ConfirmSimulatorCommand = new RelayCommand(ConfirmSimulatorSelection); _championshipCreationViewModel.CalendarDefinitionViewModel.CalendarViewModel.SelectPredefinedCalendarCommand = new RelayCommand(SelectPredefinedCalendar); _championshipCreationViewModel.CalendarDefinitionViewModel.CalendarViewModel.RandomCalendarCommand = new RelayCommand(CreateRandomCalendar); _championshipCreationViewModel.OkCommand = new RelayCommand(CreateNewChampionship); _championshipCreationViewModel.CancelCommand = new RelayCommand(CancelChampionshipCreation); _dialogWindow = _windowService.OpenWindow(_championshipCreationViewModel, "New Championship", WindowState.Maximized, SizeToContent.Manual, WindowStartupLocation.CenterOwner, DialogWindowClosed); }
public ChampionshipDto Create(ChampionshipCreationViewModel championshipCreationViewModel) { ChampionshipDto championship = new ChampionshipDto() { ChampionshipState = ChampionshipState.NotStarted, SimulatorName = championshipCreationViewModel.SelectedSimulator, ChampionshipName = championshipCreationViewModel.ChampionshipTitle, AiNamesCanChange = championshipCreationViewModel.AiNamesCanChange }; FillEvents(championship, championshipCreationViewModel); FillScoring(championship, championshipCreationViewModel); championship.NextTrack = championship.Events[0].TrackName; championship.TotalEvents = championship.Events.Count * championship.Events[0].Sessions.Count; return(championship); }
private void FillEvents(ChampionshipDto championshipDto, ChampionshipCreationViewModel championshipCreationViewModel) { List <SessionDefinitionViewModel> sessionDefinitionViewModels = championshipCreationViewModel.SessionsDefinitionViewModel.SessionsDefinitions.ToList(); championshipDto.Events = championshipCreationViewModel.CalendarDefinitionViewModel.CalendarViewModel.CalendarEntries.Select(x => CreateEvent(x, sessionDefinitionViewModels)).ToList(); }