@page "/Register" @using SkullDugDungeon.Shared.Domain @using SkullDugDungeon.Shared.Helpers Registration

User Registration

@foreach (var system in _gameSystems) { @* by default no option should be disabled so we set the field to start off as false and allow it to be changed. *@ _selectOptionDisabled = false; @*see if there exists an already selected game with the same GameSystem if not, _selectedGame will be null*@ _selectedGame = _gamesSelected.FirstOrDefault(selectedGame => selectedGame.GameSystem == system); @*if such a selection exists and it uses a different _pickAsDm value than what we are currently using, disable it as a selection; otherwise, leave it as not disabled and carry on.*@ if (_selectedGame is not null && _selectedGame.IsDungeonMaster != _pickAsDm) _selectOptionDisabled = true; @*sets the current selection option using the system taken from _gameSystems and the current _pickAsDm value*@ _selectOption = new SelectedGame(system, _pickAsDm); }
@code { //private bool _selected = false; //private int[] _gamesSelected // represents the list of valid games private readonly List _gameSystems = GameSystemHelper.GetGameSystems(); // represents the registration form Model the form will be bound to private readonly RegistrationForm _registration = new(); // represents an