Ejemplo n.º 1
0
        public void DeleteCardTests()
        {
            Card card = new Card()
            {
                Front     = "testFront",
                Back      = "testBack",
                CardOrder = 1,
                DeckId    = testDeckId,
                ImageURL  = "",
            };

            card = dal.AddCardToDeck(card);

            Assert.AreEqual(false, dal.DeleteCard(card.Id + 1), "Result should be false because the test card should be the highest Id currently in the database");
            Assert.AreEqual(true, dal.DeleteCard(card.Id));
        }
Ejemplo n.º 2
0
        public IActionResult DeleteCard(int cardId, int DeckId)
        {
            bool result = cardSqlDAL.DeleteCard(cardId);

            if (result)
            {
                return(RedirectToAction("ViewDeck", new { deckId = DeckId }));
            }
            else
            {
                return(NotFound());
            }
        }