public static Dictionary <string, float?> GetForecast(List <string> phrases) { DeleteAllForecasts(); var rows = ListUtils.GetRows(phrases.Take(500).ToList(), 100); var forecastIds = rows.Select(x => DirectApiService.CreateNewForecast( new NewForecastInfo { Phrases = x.ToArray() })).ToList(); while (DirectApiService.GetForecastList().All(x => x.StatusForecast != "Done")) { Thread.Sleep(30 * 1000); } return(forecastIds.SelectMany(x => DirectApiService.GetForecast(x).Phrases) .ToDictionary(x => x.Phrase, x => x.PremiumMin)); }
public static object Videos(UrlHelper Url, List <Video> videos, bool showDescription = false) { if (!videos.Any()) { return(string.Empty); } Func <Video, TagTd> videoBlock = x => H.td.Class("new-video")[ Htmls2.YouTube(x, 200), x.AvailableEveryOne != null ? Convert.ToBoolean(x.AvailableEveryOne) == true ? H.p[Url.VideoLink(x)] : H.p[x.Name + " ", "<a href=\"/SimpleReg/Registration\")>Доступно после регистрации</a>"] : H.p[x.Name + " ", H.a.Href(Htmls2.BaseUrl() + "SimpleReg/Registration")["Доступно после регистрации"]], showDescription&& x.ShortDescription.IsEmpty() ? p[x.ShortDescription] : null]; return(H.table[ListUtils.GetRows(videos, 3).Select(y => H.tr[y.Select(videoBlock)])]); }