public string GetThumbUrl(News news) { var url = $"https://www.belstu.by/usdata/news/{news.GroupId}/{FsOptions.ThumbsFilename}"; var filename = $"{FsOptions.ThumbsPath}\\{news.GroupId}\\{FsOptions.ThumbsFilename}"; return File.Exists(filename) ? url : ""; }
public NewsDto(News news, IImageService imageService) { Id = news.Id; Title = news.Title; Place = news.ShowplaceCategory.Showplace.Name; Date = news.EndDate == null ? news.StartDate.ToString("dd.MM.yy") : $"{news.StartDate.ToString("dd.MM.yy")} - {news.EndDate.Value.ToString("dd.MM.yy")}"; Thumb = imageService.GetThumbUrl(news); Views = news.Views; Url = $"https://{news.ShowplaceCategory.Showplace.Host}{news.Ref}"; }
public string GetThumbUrl(News news) { var url = Cache.GetThumbUrl(news); if (url == null) { url = Repository.GetThumbUrl(news); Cache.SetThumbUrl(news, url); } return url; }
public string GetThumbUrl(News news) { var url = $"https://www.belstu.by/usdata/news/{news.GroupId}/{FsOptions.ThumbsFilename}"; var client = new HttpClient(); var requestMessage = new HttpRequestMessage(HttpMethod.Get, url); var response = client.SendAsync(requestMessage); var result = response.Result.Content.ReadAsStringAsync().Result; response.Result.Dispose(); requestMessage.Dispose(); client.Dispose(); return result.Contains("404 | БГТУ") ? "" : url; }
public string GetThumbUrl(News news) { return $"https://www.belstu.by/usdata/news/{news.GroupId}/{FsOptions.ThumbsFilename}"; }
public string GetThumbUrl(News news, bool suspendCache) { return suspendCache ? Repository.GetThumbUrl(news) : GetThumbUrl(news); }
public void SetThumbUrl(News news, string url) { ThumbUrls[news.Id] = url; }
public string GetThumbUrl(News news) { return ThumbUrls.ContainsKey(news.Id) ? ThumbUrls[news.Id] : null; }