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()); } }
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); }