private IEnumerable <IDeal> ParseGraphData(GraphData graphData) { List <IDeal> deals = new List <IDeal>(); foreach (Element element in graphData.Data.Catalog.SearchStore.Elements) { PromotionalOfferPromotionalOffer promotionalOffer = element.Promotions?.PromotionalOffers.FirstOrDefault()?.PromotionalOffers?.FirstOrDefault(); if (promotionalOffer == null) { logger.Info($"{element.Title} has no promotion available"); continue; } if (promotionalOffer.DiscountSetting.DiscountPercentage != 0) { logger.Info($"{element.Title} is not free"); continue; } logger.Info($"Adding {element.Title}"); deals.Add(new Deal() { Discount = 100, Title = element.Title, Link = $"https://www.epicgames.com/store/en-US/product/{element.ProductSlug}", Image = GetImage(element), Start = GetStartDate(element), End = GetEndDate(element), }); } return(deals); }
private DateTime GetEndDate(Element element) { PromotionalOfferPromotionalOffer promotion = GetPromotion(element); return(promotion.EndDate.UtcDateTime); }