Esempio n. 1
0
        protected async Task AddCardToDeck()
        {
            SelectedDeck.Cards ??= new List <Card>();
            var newCard = new Card()
            {
                Question = question, Answer = answer
            };

            SelectedDeck.Cards.Add(newCard);
            await DeckState.AddCardToDeck(newCard, SelectedDeck);

            question  = null;
            answer    = null;
            DeckCards = SelectedDeck.Cards;
            await DeckState.UpdateDeckCards(SelectedDeck, DeckCards);

            StateHasChanged();
        }
Esempio n. 2
0
        protected async Task DeleteCard(Card card)
        {
            if (card.IsDeleteConfirm)
            {
                await DeckState.RemoveCardFromDeck(card);

                SelectedDeck.Cards.Remove(card);
                await DeckState.UpdateDeckCards(SelectedDeck, SelectedDeck.Cards);

                card.ConfirmDelete   = "";
                card.CssConfirmClass = "";
            }
            else
            {
                card.ConfirmDelete   = "Delete forever?";
                card.CssConfirmClass = "wrong";
            }
            card.IsDeleteConfirm = !card.IsDeleteConfirm;
            StateHasChanged();
        }