public async Task <IActionResult> GetCardsByDeckId(int id) { var deck = await _flashcardClient.GetDeckById(id); if (deck == null) { return(Json(new EmptyResult())); } var result = await _flashcardClient.GetCardsByDeckId(id); return(Json(result.Cards)); }
public async Task <ViewResult> Index(int id) { var deck = await _flashcardClient.GetDeckById(id); var cardsByDeckId = await _flashcardClient.GetCardsByDeckId(id); if (deck != null && cardsByDeckId != null) { var deckViewModel = new DeckViewModel() { Id = deck.Id, Name = deck.Name, TotalCards = deck.totalCards, Cards = cardsByDeckId.Cards }; return(View(deckViewModel)); } else { return(View("NotFound")); } }