private async Task SaveCard(int cardId)
        {
            using (var cardDao = new CardDao(DbContext))
            {
                var card = await cardDao.GetCardWithInstances(cardId);

                if (card == null)
                {
                    return;
                }

                var updated = await TryUpdateModelAsync(
                    card,
                    "",
                    e => e.SideA,
                    e => e.SideB,
                    e => e.Notes,
                    e => e.Tags);

                if (!updated)
                {
                    throw new ArgumentException();
                }

                card.GetInstanceSideBToA().Disabled = !GetBooleanParameter("sideBToA");

                await cardDao.UpdateCard(card);
            }
        }
Exemplo n.º 2
0
        private async Task <CardData> GetCard(int cardId)
        {
            Card card = null;

            using (var cardDao = new CardDao(DbContext))
            {
                card = await cardDao.GetCardWithInstances(cardId);
            }

            return(GetCardData(card));
        }