コード例 #1
0
        public virtual IActionResult List(ContentTypeListModel model, string viewName = "_List_ContentType")
        {
            // get das list and shit.
            _cache.Remove(typeof(ContentSettings).ToString());
            ContentSettings contentSettings = Engine.Settings.Content;

            var query = contentSettings.Types.ToList();

            if (model.Search.IsSet())
            {
                query = query.Where(c =>
                                    c.Title.Contains(model.Search) ||
                                    c.Type.Contains(model.Search) ||
                                    c.Type.Contains(model.Search) ||
                                    c.TypeName.Contains(model.Search)
                                    ).ToList();
            }

            switch (model.Order)
            {
            case "Title":
                query = query.OrderBy(n => n.Title).ToList();
                break;

            case "TitleDesc":
                query = query.OrderByDescending(n => n.Title).ToList();
                break;

            default:
                query = query.OrderBy(n => n.Title).ToList();
                break;
            }

            model.Reload(query);

            return(View(viewName, model));
        }