Ejemplo n.º 1
0
        public IActionResult Search(string q)
        {
            var statuses = _userStatusService.Search(new BaseFilter
            {
                Keyword  = q,
                PageSize = _pagerOptions.PageSize,
                Page     = _defaultPageSelection
            });

            if (statuses == null || !statuses.Any())
            {
                return(Json(new
                {
                    Items = new List <Select2ItemModel>()
                }));
            }

            var userModels = statuses
                             .Select(x => new Select2ItemModel
            {
                Id   = x.Id.ToString(),
                Text = x.Name
            });

            return(Json(userModels));
        }