コード例 #1
0
 private void SetCookieToLearnNextCard(Flashcard flashcard)
 {
     var newIndex = int.Parse(_cookies.Get(CookieKeys.IndexCard)) + 1;
     newIndex = newIndex < _db.Flashcards.Count(fc => fc.PackId == flashcard.PackId) ? 0 : newIndex;
     _cookies.Set(CookieKeys.IndexCard, newIndex.ToString());
 }
コード例 #2
0
        public ActionResult DynamicPage(Flashcard flashcard, string ButtonType)
        {
            InitCookies();

            if (ButtonType == "Next")
            {
                SetCookieToLearnNextCard(flashcard);
            }
            else if (ButtonType == "Previous")
            {
                SetCookieToLearnPreviousCard();
            }
            else if (ButtonType == "Reverse")
            {
                SetCookieToReverseCard();
            }
            return RedirectToAction("Learn");
        }