Ejemplo n.º 1
0
 public IActionResult AddCard(Card newCard)
 {
     if (authProvider.IsLoggedIn && IsCurrentUserTheOwner(newCard.DeckId))
     {
         if (String.IsNullOrEmpty(newCard.Front) && !String.IsNullOrEmpty(newCard.ImageURL))
         {
             newCard.Front = "";
         }
         cardSqlDAL.AddCardToDeck(newCard);
         return(RedirectToAction("ViewDeck", new { deckId = newCard.DeckId }));
     }
     else
     {
         return(NotFound());
     }
 }
Ejemplo n.º 2
0
        public void AddCardToDeckShouldReturnCardWithID()
        {
            Card card = new Card()
            {
                Id        = 0,
                Front     = "testFront",
                Back      = "testBack",
                CardOrder = 1,
                DeckId    = testDeckId,
                ImageURL  = ""
            };

            card = dal.AddCardToDeck(card);

            Assert.AreNotEqual(0, card.Id);
        }