private ContentResult GetCarousel(List <Announce> announces) { if (!announces.Any()) { return(null); } return(Content( CommonSiteHtmls.Carousel(announces.Select(a => a.AnnounceGroups.First()).ToList().GetRows(6) .Select(x => Html.Site().CoursesFour(x))).ToString())); }
public static string Gallary(IEntityCommonInfo entity, bool withSlider = false, string folder = "Gallery", string filter = "") { var files = GetGallaryFiles(entity, folder); if (!files.Any()) { return(null); } var result = new List <string>(); if (!filter.IsEmpty()) { files = files.Where(x => x.Contains(filter)).ToList(); } var imageDescs = new ImageMetas().Descs(); foreach (var imageFile in files.Select(x => x.Replace('\\', '/')) .Where(x => !x.ToLowerInvariant().EndsWith("-s.jpg"))) { var imageUrl = Urls.SysToWeb(imageFile).ToLowerInvariant(); var smallImageUrl = GetSmallImageUrl(imageUrl); var name = Path.GetFileName(Path.GetDirectoryName(imageFile)) + "/" + Path.GetFileName(imageFile); var alt = imageDescs.GetValueOrDefault(name.ToLower()); var tagA = H.Anchor(imageUrl, H.Img(smallImageUrl).Alt(alt).ToString()) .Class("fancy-box").Rel("entity-fancy-box").Style("padding:5px"); result.Add(tagA.ToString()); } if (!withSlider || result.Count <= 3) { return(result.JoinWith("").Tag("div")); } return(CommonSiteHtmls.Carousel(result.CutInPartCount(3) .Select(x => H.span[x.JoinWith("")].Style("margin:0 20px").Class("fit-width-item")), true).ToString()); }