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 static ProductButton GetMainProductOfToday(IEnumerable <ActivePoolsForRaceDay> raceDays, DateTime date) { IList <ActivePoolsForRaceDay> todaysRaceDays = raceDays .Where(x => Equals(x.RaceDay.RaceDayDate, date.AsDate()) && x.RaceDay.IsDomestic() && x.ProgressStatus != ProgressStatus.Abandoned) .Where(x => x.Products.Any(p => p.Product.IsVGame() && p.IsOpenForBet)) .OrderBy(x => x.StartTime) .ToList(); if (!todaysRaceDays.Any()) { return(null); } ActivePoolsForRaceDay raceDay = todaysRaceDays.OrderByDescending(x => x.Products.Max(p => (int)p.Product)).First(); BetTypeCode product = raceDay.Products .Where(x => x.Product.IsVGame() && x.IsOpenForBet) .OrderByDescending(x => (int)x.Product) .Select(x => x.Product) .First(); return(product.IsV75OrV76() ? null : ProductButton.Create(raceDay.RaceDay, product)); }