Example #1
0
        //
        // GET: /Cms/Files/

        public ActionResult Index(FileRequest request)
        {
          //  ViewData.Add("Channal", new SelectList(EnumHelper.GetItemValueList<EnumChannal>(), "Key", "Value"));
            var model = new Files();
            this.RenderMyViewData(model);
            var result = this.ProjectService.GetFileList(request);
            return View(result);
        }
Example #2
0
        public IEnumerable<Files> GetFileList(FileRequest request = null)
        {
            request = request ?? new FileRequest();
            using (var dbContext = new ProjectDbContext())
            {
                IQueryable<Files> files = dbContext.Files;


                if (!string.IsNullOrEmpty(request.Name))
                    files = files.Where(u => u.Name.Contains(request.Name));

               
                if (!string.IsNullOrEmpty(request.Type))
                    files = files.Where(u => u.Type.Contains(request.Type));

                return files.OrderByDescending(u => u.ID).ToPagedList(request.PageIndex, request.PageSize);
            }
        }