/// <summary> /// Get all existing decks. /// </summary> /// <returns></returns> public IHttpActionResult Get() { DeckService deckService = CreateDeckService(); var decks = deckService.GetDecks(); return(Ok(decks)); }
// GET: Create public ActionResult Create(int id, bool isCard) { var userId = User.Identity.GetUserId(); var deckService = new DeckService(userId); var cardService = new CardService(); if (isCard) { var allDecks = deckService.GetDecks(); var card = cardService.GetCardById(id); var cardToDeck = new AssignmentViewModel(isCard) { CardId = id, CardName = card.Name, DeckList = allDecks }; return(View(cardToDeck)); } var allCards = cardService.GetCards(); var deck = deckService.GetDeckById(id); var deckToCard = new AssignmentViewModel(isCard) { DeckId = id, DeckName = deck.Name, CardList = allCards }; return(View(deckToCard)); }
// GET: Deck public ActionResult Index() { var userId = User.Identity.GetUserId(); var service = new DeckService(userId); var model = service.GetDecks(); return(View(model)); }