Esempio n. 1
0
        public ActionResult Unarchive(int cardId)
        {
            var tbl = new CardRepository();
            var card = tbl.Single(cardId);
            card.IsArchived = false;
            tbl.Save(card);

            return Json(true);
        }
Esempio n. 2
0
        public ActionResult MarkIncorrect(int cardId)
        {
            var tbl = new CardRepository();
            var card = tbl.Single(cardId);
            card.TimesIncorrect++;
            tbl.Save(card);

            return Json(true);
        }
Esempio n. 3
0
        private static List<Card> GetWords(bool active)
        {
            var activeWords = new List<Card>();

            var tbl = new CardRepository();
            IEnumerable<dynamic> words = tbl.All(where: "WHERE IsArchived=@0", args: (active == true ? 0 : 1));
            foreach (var record in words)
            {
                var card = new Card();
                card.id = record.CardId;
                card.correctCount = record.TimesCorrect;
                card.incorrectCount = record.TimesIncorrect;
                card.isArchived = record.IsArchived == 1 ? true : false;
                card.recto = record.Recto;
                card.verso = record.Verso;

                activeWords.Add(card);
            }
            return activeWords;
        }
Esempio n. 4
0
 public CardController()
 {
     _repo = new CardRepository();
 }