private IQueryable <QuantityUnitDto> GetDetail(QuantityUnitSearchModel searchModel) { IQueryable <QuantityUnitDto> list = null; if (!searchModel.HasAnyValue()) { list = _quantityUnitService.GetAll(); } else { var predicate = PredicateBuilder.True <QuantityUnitDto>(); if (!searchModel.UnitName.IsNull()) { predicate = predicate.And(c => c.UnitName.Contains(searchModel.UnitName)); } list = _quantityUnitService.GetAll().AsExpandable().Where(predicate); } return(list); }
public virtual ActionResult GetDetails([DataSourceRequest] DataSourceRequest request, QuantityUnitSearchModel searchModel) { var list = GetDetail(searchModel); return(Json(list.ToDataSourceResult(request), JsonRequestBehavior.AllowGet)); }