Exemple #1
0
        public JsonResult SearchByProductGroupName(string searchTerm, int pageSize, int pageNum, int?productId, int?campaignId)
        {
            _productFacade = new ProductFacade();
            List <ProductGroupEntity> productgroups = _productFacade.GetProductGroupByName(searchTerm, pageSize, pageNum, productId, campaignId);
            int productgroupCount = _productFacade.GetProductGroupCountByName(searchTerm, pageSize, pageNum, productId, campaignId);

            //Select2PagedResult pagedBranches = ProductGroupToSelect2Format(productgroups, productgroupCount);

            Select2PagedResult pagedBranches = new Select2PagedResult();

            pagedBranches.Results = new List <Select2Result>();

            foreach (ProductGroupEntity productgroup in productgroups)
            {
                pagedBranches.Results.Add(new Select2Result {
                    id = productgroup.ProductGroupId, text = productgroup.ProductGroupName
                });
            }

            pagedBranches.Total = productgroupCount;

            return(Json(pagedBranches, JsonRequestBehavior.AllowGet));
        }