Example #1
0
        public ActionResult ViewTopService()
        {
            var    list   = Contents.ListAllByTaxonomy("Service").OrderByDescending(x => x.Modified).Take(15).ToList();
            string output = "";

            if (list.Count > 0)
            {
                output += "<div id=\"owl-demo\" class=\"owl-carousel owl-theme\">";
                foreach (var item in list)
                {
                    if (item.Thumbnail != null)
                    {
                        output += "<div class=\"item\">";
                        output += "<div class=\"item-img\">";
                        output += "<a href=\"" + item.Slug + "\" title=\"" + item.Title + "\">";
                        output += "<img src=\"" + item.Thumbnail + "\" alt=\"" + item.Title + "\" />";
                        output += "</a>";
                        output += "</div>";
                        output += "<div class=\"item-text\">";
                        output += "<a href=\"" + item.Slug + "\" title=\"" + item.Title + "\">";
                        output += item.Title;
                        output += "</a>";
                        output += "</div>";
                        output += "</div>";
                    }
                }
                output += "</div>";
            }

            ViewBag.Data = output;
            return(PartialView());
        }
Example #2
0
        public ActionResult Index(int?page, string SearchString)
        {
            int pageNum = page ?? 1;
            var entity  = Dao.ListAllByTaxonomy("Page");
            var output  = new List <PagesModel>();

            foreach (var item in entity)
            {
                output.Add(new PagesModel
                {
                    CategoryId       = item.CategoryId,
                    Content          = item.Content,
                    Date             = item.Date,
                    Description      = item.Description,
                    Id               = item.Id,
                    Meta_Description = item.Meta_Description,
                    Meta_Keyword     = item.Meta_Keyword,
                    Meta_Title       = item.Meta_Title,
                    Modified         = item.Modified,
                    Name             = item.Name,
                    Order            = item.Order,
                    ParentId         = item.ParentId,
                    Slug             = item.Slug,
                    Status           = item.Status,
                    Taxonomy         = item.Taxonomy,
                    Thumbnail        = item.Thumbnail,
                    Title            = item.Title,
                    UserId           = item.UserId,
                    View             = item.View
                });
            }
            if (!string.IsNullOrEmpty(SearchString))
            {
                return(View(output.Where(x => x.Title.Contains(SearchString) || x.Name.Contains(SearchString)).OrderByDescending(x => x.Modified).ToPagedList(pageNum, 20)));
            }
            else
            {
                return(View(output.OrderByDescending(x => x.Modified).ToPagedList(pageNum, 20)));
            }
        }