Beispiel #1
0
        public async void HandleValidSubmit()
        {
            Console.WriteLine("CharacterForm::HandleValidSubmit");
            if (IsChanged())
            {
                Character.Roles = GetRolesFromCheckboxes();
                if (Character.Id == null && Character.Name == null && Character.Name != "")
                {
                    Console.WriteLine("Id and name are null, doing nothing");
                }
                else if (Character.Id == null)
                {
                    Character = await characterService.AddCharacter(Player, Character);

                    PlayerForm.AddCharacter(Character);
                    ToastService.UpdateMessage(this, $"Successfully added {Character.Name}", ToastLevel.Success);
                }
                else
                {
                    characterService.UpdateCharacter(Player, Character);
                    PlayerForm.UpdateCharacters();
                    ToastService.UpdateMessage(this, $"Successfully updated {Character.Name}", ToastLevel.Success);
                }
                originalClass = Character.CharacterClass;
                originalName  = Character.Name;
            }
        }
Beispiel #2
0
        public async void DeleteCharacter()
        {
            bool confirmed = await JSRuntime.InvokeAsync <bool>("confirm", $"Are you sure you want to delete {Character.Name}?");

            if (confirmed)
            {
                characterService.DeleteCharacter(Player, Character);
                PlayerForm.DeleteCharacter(Character);
                ToastService.UpdateMessage(this, $"Successfully deleted {Character.Name}", ToastLevel.Success);
            }
        }