Пример #1
0
        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 : "";
        }
Пример #2
0
 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}";
 }
Пример #3
0
        public string GetThumbUrl(News news)
        {
            var url = Cache.GetThumbUrl(news);

            if (url == null)
            {
                url = Repository.GetThumbUrl(news);
                Cache.SetThumbUrl(news, url);
            }

            return url;
        }
Пример #4
0
        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}";
 }
Пример #6
0
 public string GetThumbUrl(News news, bool suspendCache)
 {
     return suspendCache
         ? Repository.GetThumbUrl(news)
         : GetThumbUrl(news);
 }
Пример #7
0
 public void SetThumbUrl(News news, string url)
 {
     ThumbUrls[news.Id] = url;
 }
Пример #8
0
 public string GetThumbUrl(News news)
 {
     return ThumbUrls.ContainsKey(news.Id) 
         ? ThumbUrls[news.Id]
         : null;
 }