public ResultsDto ParseDeckList(CalcValuesDto decklist) { Cards.Cards.PopulateCardList(); List <CardBundle> cardList = new List <CardBundle>(); string[] cardNames = decklist.DeckList.Split(System.Environment.NewLine); for (int i = 0; i < cardNames.Length; i++) { int numC = Int32.Parse((new string(cardNames[i].Where(char.IsNumber).ToArray()))); Card c = Card.FindCardWherePropertyEquals(Cards.Cards.FullCardList, (c) => { return(c.Name == new string(cardNames[i].Where(c => (c <'0' || c> '9')).ToArray()).Trim()); }); if (c == null) { continue; } else { cardList.Add(new CardBundle(c, numC)); } } return(new ResultsDto { Cards = cardList }); }
public IActionResult Parse([FromBody] CalcValuesDto input) { return(Ok(_calculator.ParseDeckList(input))); }