private List <CustomerBet> GetCustomerBets() { var customerBets = _httpHandler.GetString(_configrationManager.BetServiceUrl); if (string.IsNullOrEmpty(customerBets)) { return(new List <CustomerBet>()); } return(JsonConvert.DeserializeObject <List <CustomerBet> >(customerBets)); }
public List <RaceViewModel> GetTodaysRaces() { var racesStringData = _httpHandler.GetString(_configrationManager.RaceServiceUrl); var races = new List <RaceViewModel>(); if (!string.IsNullOrEmpty(racesStringData)) { return(JsonConvert.DeserializeObject <List <RaceViewModel> >(racesStringData)); } return(races); }
public IList <RaceDto> GetRaces() { var racesStringData = _httpHandler.GetString(_configrationManager.RaceServiceUrl); List <Race> races = new List <Race>(); if (!string.IsNullOrEmpty(racesStringData)) { races = JsonConvert.DeserializeObject <List <Race> >(racesStringData); if (races != null) { races.RemoveAll(a => !a.Start.Date.Equals(DateTime.Now.Date)); } } var raceDtoList = _mapper.Map <List <Race>, List <RaceDto> >(races); if (raceDtoList != null) { raceDtoList.ForEach(raceDto => { raceDto.TotalBetAmount = _customerBetServiceProxy.GetTotalBetAmountForRace(raceDto.Id); if (raceDto.Horses != null) { raceDto.Horses.ForEach(horseDto => horseDto.NumberOfBets = _customerBetServiceProxy.GetNumberOfBetsPlaced(horseDto.Id)); } }); } else { raceDtoList = new List <RaceDto>(); } return(raceDtoList); }
public List <CustomerDto> GetCustomer() { var customers = JsonConvert.DeserializeObject <List <Customer> >(_httpHandler.GetString(_configrationManager.CustomerServiceUrl)); return(_mapper.Map <List <Customer>, List <CustomerDto> >(customers)); }