private void MapSettledBets(List<Customer> customers) { List<BetDto> settledBets = _fileRepository.LoadList<BetDto>(GetSettledBetsFilePath()); foreach (BetDto settledBet in settledBets) { Customer customer = customers.SingleOrDefault(c => c.Id == settledBet.CustomerId); if (customer == null) { customer = new Customer {Id = settledBet.CustomerId}; customers.Add(customer); } customer.SettledBets.Add(Mapper.Map<Bet>(settledBet)); } }
private void MapUnSettledBets(List<Customer> customers) { List<BetDto> unSettledBets = _fileRepository.LoadList<BetDto>(HttpContext.Server.MapPath("~/bin/Unsettled.csv")); foreach (BetDto unSettledBet in unSettledBets) { Customer customer = customers.SingleOrDefault(c => c.Id == unSettledBet.CustomerId); if (customer == null) { customer = new Customer {Id = unSettledBet.CustomerId}; customers.Add(customer); } customer.UnSettledBets.Add(Mapper.Map<Bet>(unSettledBet)); } }