Example #1
0
        //[AllowAnonymous]
        public IActionResult Index(ThreeDFilterModel filter)
        {
            var ThreeDQuery = this._dbContext.threeD.Include(p => p.objAttachment).ToList();

            //var threeDQuery = this._dbContext.threeD.Include(p => p.Id).AsQueryable();

            //filter = filter ?? new ThreeDFilterModel();

            //if (!string.IsNullOrWhiteSpace(filter.Name))
            //    threeDQuery = threeDQuery.Where(p => p.Name.ToLower().Contains(filter.Name.ToLower()));

            ////if (!string.IsNullOrWhiteSpace(filter.Category))
            ////    threeDQuery = threeDQuery.Where(p => p.Category.ToLower().Contains(filter.Category.ToLower()));

            //var model = threeDQuery.ToList();
            //return View("Index", model);
            return(View("Index", model: ThreeDQuery));
        }
Example #2
0
        public IActionResult AjaxSearch(ThreeDFilterModel filter)
        {
            var ThreeDQuery = this._dbContext.threeD.Include(p => p.objAttachment)
                              .Include(c => c.Category)
                              .AsQueryable();

            filter = filter ?? new ThreeDFilterModel();

            if (!string.IsNullOrWhiteSpace(filter.Name))
            {
                ThreeDQuery = ThreeDQuery.Where(p => p.Name.ToLower().Contains(filter.Name.ToLower()));
            }
            if (!string.IsNullOrWhiteSpace(filter.Category))
            {
                ThreeDQuery = ThreeDQuery.Where(p => p.Category.Name.ToLower().Contains(filter.Category.ToLower()));
            }

            var model = ThreeDQuery.ToList();

            return(PartialView("_IndexTable", model: model));
        }