public static DeckBuilder getPageItems(CardSearchModel model, int numPage) { DeckBuilder displayCards = new DeckBuilder(); displayCards.PageNum = numPage; int nbrCards = model.AllCards.Count(); displayCards.PageCount = (int)Math.Floor((decimal)(nbrCards / displayCards.PageSize)) + 1; displayCards.Cards = model.AllCards.Skip(displayCards.PageSize * (numPage - 1)).Take(displayCards.PageSize); return(displayCards); }
public static DeckBuilder getPageItems(CardSearchModel model, int numPage) { DeckBuilder displayCards = new DeckBuilder(); displayCards.PageNum = numPage; int nbrCards = model.AllCards.Count(); displayCards.PageCount = (int)Math.Floor((decimal)(nbrCards / displayCards.PageSize)) + 1; displayCards.Cards = model.AllCards.Skip(displayCards.PageSize * (numPage - 1)).Take(displayCards.PageSize); //KeyValuePair<string, int> DeckCards = new List<KeyValuePair<string, int>>(); foreach (CardModel card in displayCards.Cards) { displayCards.DeckCards.Add(new KeyValuePair <string, int>(card.Id, 0)); } return(displayCards); }