Beispiel #1
0
        public JsonResult SearchByAreaName(string searchTerm, int pageSize, int pageNum, int?subAreaId)
        {
            //Get the paged results and the total count of the results for this query.
            _productFacade = new ProductFacade();
            List <AreaEntity> areas = _productFacade.GetAreaByName(searchTerm, pageSize, pageNum, subAreaId);
            int areasCount          = _productFacade.GetAreaCountByName(searchTerm, pageSize, pageNum, subAreaId);

            //Translate the attendees into a format the select2 dropdown expects
            //Select2PagedResult pagedBranches = AreaToSelect2Format(areas, areasCount);

            Select2PagedResult pagedBranches = new Select2PagedResult();

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

            foreach (AreaEntity area in areas)
            {
                pagedBranches.Results.Add(new Select2Result {
                    id = area.AreaId, text = area.AreaName
                });
            }

            pagedBranches.Total = areasCount;

            //Return the data as a jsonp result
            return(Json(pagedBranches, JsonRequestBehavior.AllowGet));
        }