public IActionResponse <List <PricingItem> > Search(FilterPricingItemModel filterModel)
        {
            var response = new ActionResponse <List <PricingItem> >();


            var result = _pricingItem.Where(x => !x.IsDeleted &&
                                            (!string.IsNullOrEmpty(filterModel.DocumentType) ? x.DocumentType.Contains(filterModel.DocumentType) : true) &&
                                            (!string.IsNullOrEmpty(filterModel.Lable) ? x.Lable.Contains(filterModel.Lable) : true) &&
                                            (filterModel.PricingItemUnit > 0 ? x.PricingItemUnit == filterModel.PricingItemUnit : true) &&
                                            (filterModel.CategoryId > 0 ? x.CategoryId == filterModel.CategoryId : true)
                                            )
                         .AsNoTracking()
                         .OrderByDescending(x => x.PricingItemId)
                         .Take(filterModel.ItemsCount)
                         .ToList();

            if (result.Any())
            {
                response.IsSuccessful = true;
            }
            else
            {
                response.Message = BusinessMessage.RecordNotFound;
            }

            response.Result = result;
            return(response);
        }
Ejemplo n.º 2
0
        public virtual ActionResult Search(FilterPricingItemModel model)
        {
            GetPricingItemCategories(model.CategoryId.ToString(), true);
            GetPricingItemUnits(model.PricingItemUnit.ToString(), true);
            var result = _pricingItemBusiness.Search(model);

            if (!Request.IsAjaxRequest())
            {
                return(View(result));
            }
            return(PartialView(MVC.PricingItem.Views.Partials._SearchList, result.Result));
        }