//gets and returns offers html IEnumerable <XElement> GetOfferHtml(DateTime d) { CurrentDate = d; Offers = GetDriverOffers(); DailyOffers = GetDailyOffers(Offers.ToList()); Offers = GetDriverOffers().Distinct().ToList(); var offers = Offers?.GroupBy(o => o.DepartureTime); string test = JsonConvert.SerializeObject(DailyOffers); return(offers?.FirstOrDefault(o => o.Key == d)?.Select(o => new XElement("a", new XAttribute("campus", o.Campus), new XAttribute("arrivalTime", o.ArrivalTime), new XAttribute("class", "btn-success text-white p-1 rounded d-flex justify-content-center w-75 mx-auto"), new XAttribute("data-toggle", "modal"), new XAttribute("data-target", "#OffersModal"), new XAttribute("data-date", $"{d.Date}"), new XAttribute("data-offers", $"{test}"), "Offers" ) )); }