public ICollection <HistoryInfo> GetNClientsHistoryRecords(int clientId, int quantityOfRecords)
        {
            if (quantityOfRecords <= 0)
            {
                throw new ArgumentException("Invalid number of records");
            }

            List <HistoryInfo>   historyInfos    = new List <HistoryInfo>();
            List <HistoryEntity> historyEntities = historyTableRepository.GetHistory().Where(w => (w.BuyerId == clientId) || (w.SellerId == clientId)).ToList();

            for (int i = 0; (i < quantityOfRecords) && (i < historyEntities.Count); i++)
            {
                historyInfos.Add(new HistoryInfo()
                {
                    Id               = historyEntities[i].Id,
                    BuyerId          = historyEntities[i].BuyerId,
                    SellerId         = historyEntities[i].SellerId,
                    TypeOfStock      = historyEntities[i].TypeOfStock,
                    QuantityOfStocks = historyEntities[i].QuantityOfStocks,
                    FullPrice        = historyEntities[i].FullPrice
                });
            }

            return(historyInfos);
        }
Beispiel #2
0
 public ICollection <HistoryEntity> GetFullHistory()
 {
     return(historyTableRepository.GetHistory());
 }