public IActionResult GetHeapingAlgorithms() { var ids = HeapingAlgorithms.Instance.Ids; var result = ids.Select(id => new HeapingAlgorithmViewModel(id, HeapingAlgo.NameFromId(id, localizer), HeapingAlgo.DescriptionFromId(id, localizer)) ); return(base.Ok(result)); }
public async Task <IActionResult> GetUserDecksWithHeaps() { var userId = await UserServices.UserIdFromContextAsync(HttpContext, userManager); var decks = new GetUserDecksWithHeaps(dbContext).Run(userId); var result = decks.Select(deck => new GetUserDecksWithHeapsViewModel( deck.DeckId, deck.Description, HeapingAlgo.NameFromId(deck.HeapingAlgorithmId, localizer), HeapingAlgo.DescriptionFromId(deck.HeapingAlgorithmId, localizer), deck.CardCount, deck.Heaps.OrderBy(heap => heap.HeapId), localizer ) ); return(base.Ok(result)); }