public async Task <IList <ShortcutModel> > GetShortcutsAsync(ShortcutFilterModel criterias) { if (criterias == null) { criterias = new ShortcutFilterModel(); } try { var shortcutPageList = await _shortcutService.GetAsync(new ShortcutFilter() { Page = criterias.Page, PageSize = _pagerOptions.PageSize, Keyword = criterias.Search, TypeId = criterias.TypeId }); var shortcuts = shortcutPageList.Collections.Select(x => new ShortcutModel { Description = x.Description, Name = x.Name, Icon = x.Icon, Id = x.Id, TypeId = (ShortcutType)x.TypeId, Url = x.Url }).ToList(); return(shortcuts); } catch (Exception) { throw; } }
public async Task <IActionResult> Index(ShortcutFilterModel filter) { var shortcutPageList = await _shortcutService.GetAsync(new ShortcutFilter { Page = filter.Page, PageSize = _pagerOptions.PageSize, Keyword = filter.Search, TypeId = filter.TypeId, CanGetInactived = true, StatusId = filter.StatusId }); var shortcuts = shortcutPageList.Collections.Select(x => new ShortcutModel { Description = x.Description, Id = x.Id, Name = x.Name, Icon = x.Icon, TypeId = (ShortcutType)x.TypeId, Url = x.Url, Order = x.Order, StatusId = (ShortcutStatus)x.StatusId, }); var shortcutPage = new PageListModel <ShortcutModel>(shortcuts) { Filter = filter, TotalPage = shortcutPageList.TotalPage, TotalResult = shortcutPageList.TotalResult }; if (_httpHelper.IsAjaxRequest(Request)) { return(PartialView("Partial/_ShortcutTable", shortcutPage)); } return(View(shortcutPage)); }