public async Task <IViewComponentResult> InvokeAsync(ListSettingsQuery query) { query.EnsurePaging(ListSettingsQuery.DefaultPageSize, _settingsProvider.MaxPageSize()); ViewData[nameof(SettingListModel)] = new SettingListModel { Query = query, Result = await _queryDispatcher.DispatchAsync(query, HttpContext.RequestAborted) }; return(View(query)); }
public async Task <ActionResult <IEnumerable <SettingData> > > List([FromQuery] ListSettingsQuery model) { if (model == null) { return(BadRequest()); } model.EnsurePaging(ListSettingsQuery.DefaultPageSize, _settingsProvider.MaxPageSize()); var result = await _queryDispatcher.DispatchAsync(model, HttpContext.RequestAborted); return(Ok(result.Items ?? Enumerable.Empty <SettingData>())); }