public async Task <IActionResult> Search(SearchSettingFieldInstanceCommand command)
        {
            var spec = SettingFieldInstanceSpecs.SearchByQuery(command.Query)
                       .And(SettingFieldInstanceSpecs.GetManyByParentId(command.ParentId));
            var queryable = _settingFieldInstanceRepository.QueryAsync(spec, command.Sorts);
            var items     = await queryable.Skip(command.Skip).Take(command.Take).ToListAsync();

            return(Ok(new QueryResult <SettingFieldInstanceCommand>
            {
                Count = queryable.Count(),
                Items = items.To <List <SettingFieldInstanceCommand> >()
            }));
        }
Esempio n. 2
0
        public async Task <IActionResult> SettingView(Guid id)
        {
            var settingFieldInstanceSpecs  = SettingFieldInstanceSpecs.GetManyByParentId(id);
            var settingActionInstanceSpecs = SettingActionInstanceSpecs.GetManyByParentId(id);
            var settingView = await _settingViewRepository.GetByIdAsync(id);

            var settingFieldInstances = await _settingFieldInstanceRepository.GetManyAsync(settingFieldInstanceSpecs);

            var settingActionInstances = await _settingActionInstanceRepository.GetManyAsync(settingActionInstanceSpecs);

            return(Ok(new
            {
                settingView = settingView.To <SettingViewCommand>(),
                settingFieldInstances = settingFieldInstances.To <List <SettingFieldInstanceCommand> >(),
                settingActionInstances = settingActionInstances.To <List <SettingActionInstanceCommand> >()
            }));
        }