Example #1
0
        public async Task <IActionResult> Search(SearchSettingActionInstanceCommand command)
        {
            var spec = SettingActionInstanceSpecs.SearchByQuery(command.Query)
                       .And(SettingActionInstanceSpecs.GetManyByParentId(command.ParentId));
            var queryable = _settingActionInstanceRepository.QueryAsync(spec, command.Sorts);
            var items     = await queryable.Skip(command.Skip).Take(command.Take).ToListAsync();

            return(Ok(new QueryResult <SettingActionInstanceCommand>
            {
                Count = queryable.Count(),
                Items = items.To <List <SettingActionInstanceCommand> >()
            }));
        }
Example #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> >()
            }));
        }