public IList <ProductButton> GetFeaturedProductButtons() { IList <ActivePoolsForRaceDay> racedays = _raceDayServiceGateway.GetActivePoolsForRaceDay(); DateTime date = _betDateProvider.Now; IList <ProductButton> buttons = new List <ProductButton>(); try { ProductButton mainProductOfToday = GetMainProductOfToday(racedays, date); if (mainProductOfToday != null) { buttons.Add(mainProductOfToday); } ProductButton mainProductOfTheWeek = GetMainProductOfTheWeek(racedays, date); if (mainProductOfTheWeek != null) { buttons.Add(mainProductOfTheWeek); } } catch (Exception e) { Log.Error("GetFeaturedProductButtons failed to create buttons", e); } return(buttons); }
public string FindLinkForNextAvailableProduct(string value, string baseLink) { BetTypeCode product = value.TryCastTo <BetTypeCode>(); if (product == BetTypeCode.Undefined || !product.IsVGame()) { return(null); } IList <ActivePoolsForRaceDay> racedays = _raceDayServiceGateway.GetActivePoolsForRaceDay(); ActivePoolsForRaceDay raceday = racedays .OrderBy(x => x.StartTime) .FirstOrDefault(x => x.Products.Any(p => p.Product == product && p.IsOpenForBet)); return(raceday == null ? null : $"{baseLink}#/{RaceDayKey.ToString(raceday.RaceDay)}/{product}/"); }
public IHttpActionResult GetActiveRaceDayPools() { IList <Service.RaceDay.Contracts.PoolService.ActivePoolsForRaceDay> activeRaceDayPools = _raceDayServiceGateway.GetActivePoolsForRaceDay(); //--- FEATURE TOGGLING START--- Remove Qplus from RaceDay foreach (var activePoolsForRaceDay in activeRaceDayPools) { activePoolsForRaceDay.Products = activePoolsForRaceDay.Products.Where(x => x.Product != BetTypeCode.QPlus).ToList(); } // removes all products for Gallop foreach (var gallopRaceDay in activeRaceDayPools.Where(pool => pool.SportType == SportType.G)) { gallopRaceDay.Products = new List <ProductForRaceDay>(); } //--- FEATURE TOGGLING END--- IList <ActivePoolsForRaceDay> activeRaceDays = _mapper.Map <IList <ActivePoolsForRaceDay> >(activeRaceDayPools); List <ActivePoolsForRaceDayGroupedByDate> groupedByDate = activeRaceDays .GroupBy(g => g.StartTime.Date) .Select(s => new ActivePoolsForRaceDayGroupedByDate { Date = s.Key.Date, PoolsForRaceDay = s.OrderBy(x => x.StartTime).ToList() }) .OrderBy(x => x.Date) .ToList(); return(Ok(RestResult <List <ActivePoolsForRaceDayGroupedByDate> > .CreateSuccess(groupedByDate))); }