Пример #1
0
        public IActionResult SearchTypes(string q, int?currentId = null)
        {
            var shortcuts = _shortcutService.GetShortcutTypes(new ShortcutTypeFilter
            {
                Id       = currentId,
                Keyword  = q,
                Page     = _defaultPageSelection,
                PageSize = _pagerOptions.PageSize
            });

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

            var shortcutSeletions = shortcuts
                                    .Select(x => new Select2ItemModel
            {
                Id   = x.Id.ToString(),
                Text = x.Text
            });

            return(Json(shortcutSeletions));
        }