public async Task <IActionResult> Get([FromQuery] GetAllCategoriesQuery query)
        {
            if (query == null)
            {
                query = new GetAllCategoriesQuery();
            }
            var results = await _queryExecutor.ExecuteAsync(query);

            var rootResults  = results.ToLookup(x => x.RootCategory.Name, i => i);
            var sortedResult = new List <RootCategoryWithCategories>();

            foreach (IGrouping <string, Category> groupItem in rootResults)
            {
                var el = new RootCategoryWithCategories()
                {
                    Name       = groupItem.Key,
                    Categories = new List <Category>()
                };
                foreach (var listEl in groupItem)
                {
                    el.Categories.Add(listEl);
                }
                sortedResult.Add(el);
            }
            return(_apiResponseHelper.SimpleQueryResponse(this, sortedResult));
        }
        public async Task <JsonResult> Get()
        {
            var query   = new GetAllBreedsQuery();
            var results = await _domainRepository.ExecuteQueryAsync(query);

            return(_apiResponseHelper.SimpleQueryResponse(results));
        }
        public async Task <IActionResult> Get()
        {
            var query   = new GetAllBreedsQuery();
            var results = await _queryExecutor.ExecuteAsync(query);

            return(_apiResponseHelper.SimpleQueryResponse(this, results));
        }
Esempio n. 4
0
        public async Task <JsonResult> Get([FromQuery] SearchCatSummariesQuery query)
        {
            if (query == null)
            {
                query = new SearchCatSummariesQuery();
            }
            var results = await _domainRepository.ExecuteQueryAsync(query);

            return(_apiResponseHelper.SimpleQueryResponse(results));
        }
        public async Task <IActionResult> Get([FromQuery] SearchCatSummariesQuery query)
        {
            if (query == null)
            {
                query = new SearchCatSummariesQuery();
            }
            var results = await _queryExecutor.ExecuteAsync(query);

            return(_apiResponseHelper.SimpleQueryResponse(this, results));
        }
Esempio n. 6
0
        public async Task <IActionResult> Get([FromQuery] GetCustomEntityDataModelSchemaDetailsByDefinitionCodeRangeQuery rangeQuery)
        {
            if (rangeQuery.CustomEntityDefinitionCodes == null)
            {
                return(_apiResponseHelper.SimpleQueryResponse(this, Enumerable.Empty <CustomEntityDataModelSchema>()));
            }
            var result = await _queryExecutor.ExecuteAsync(rangeQuery);

            return(_apiResponseHelper.SimpleQueryResponse(this, result.FilterAndOrderByKeys(rangeQuery.CustomEntityDefinitionCodes)));
        }
Esempio n. 7
0
        public async Task <IActionResult> Get([FromQuery] SearchUserSummariesQuery query)
        {
            if (query == null)
            {
                query = new SearchUserSummariesQuery();
            }
            ApiPagingHelper.SetDefaultBounds(query);

            var results = await _queryExecutor.ExecuteAsync(query);

            return(_apiResponseHelper.SimpleQueryResponse(this, results));
        }
Esempio n. 8
0
        public async Task<IActionResult> Get([FromQuery] SearchCustomEntitySummariesQuery query, [FromQuery] GetCustomEntitySummariesByIdRangeQuery rangeQuery)
        {
            if (rangeQuery != null && rangeQuery.CustomEntityIds != null)
            {
                var rangeResults = await _queryExecutor.ExecuteAsync(rangeQuery);
                return _apiResponseHelper.SimpleQueryResponse(this, rangeResults.FilterAndOrderByKeys(rangeQuery.CustomEntityIds));
            }

            if (query == null) query = new SearchCustomEntitySummariesQuery();

            var results = await _queryExecutor.ExecuteAsync(query);
            return _apiResponseHelper.SimpleQueryResponse(this, results);
        }
Esempio n. 9
0
        public async Task <IHttpActionResult> Get(int pageVersionModuleId, PageVersionSectionModulesActionDataType dataType = PageVersionSectionModulesActionDataType.RenderDetails)
        {
            if (dataType == PageVersionSectionModulesActionDataType.UpdateCommand)
            {
                return(await GetById <UpdatePageVersionModuleCommand>(pageVersionModuleId));
            }

            var query = new GetPageVersionModuleRenderDetailsByIdQuery()
            {
                PageVersionModuleId = pageVersionModuleId, WorkFlowStatus = WorkFlowStatusQuery.Latest
            };
            var results = await _queryExecutor.ExecuteAsync(query);

            return(_apiResponseHelper.SimpleQueryResponse(this, results));
        }
Esempio n. 10
0
        public async Task <IActionResult> Get()
        {
            var query = new GetCurrentUserAccountDetailsQuery();

            var results = await _queryExecutor.ExecuteAsync(query);

            return(_apiResponseHelper.SimpleQueryResponse(this, results));
        }
 public JsonResult GetSettings()
 {
     return(_apiResponseHelper.SimpleQueryResponse(new
     {
         _imageAssetsSettings.MaxUploadWidth,
         _imageAssetsSettings.MaxUploadHeight
     }));
 }
Esempio n. 12
0
        public async Task <IActionResult> Get([FromQuery] SearchImageAssetSummariesQuery query, [FromQuery] GetImageAssetRenderDetailsByIdRangeQuery rangeQuery)
        {
            if (rangeQuery != null && rangeQuery.ImageAssetIds != null)
            {
                var rangeResults = await _queryExecutor.ExecuteAsync(rangeQuery);

                return(_apiResponseHelper.SimpleQueryResponse(this, rangeResults.FilterAndOrderByKeys(rangeQuery.ImageAssetIds)));
            }

            if (query == null)
            {
                query = new SearchImageAssetSummariesQuery();
            }

            var results = await _queryExecutor.ExecuteAsync(query);

            return(_apiResponseHelper.SimpleQueryResponse(this, results));
        }
Esempio n. 13
0
        public async Task <IHttpActionResult> Get([FromUri] SearchImageAssetSummariesQuery query, [FromUri] GetByIdRangeQuery <ImageAssetRenderDetails> rangeQuery)
        {
            if (rangeQuery != null && rangeQuery.Ids != null)
            {
                var rangeResults = await _queryExecutor.ExecuteAsync(rangeQuery);

                return(_apiResponseHelper.SimpleQueryResponse(this, rangeResults.ToFilteredAndOrderedCollection(rangeQuery.Ids)));
            }

            if (query == null)
            {
                query = new SearchImageAssetSummariesQuery();
            }

            var results = await _queryExecutor.ExecuteAsync(query);

            return(_apiResponseHelper.SimpleQueryResponse(this, results));
        }
Esempio n. 14
0
        public async Task <JsonResult> Get(int customEntityVersionPageBlockId, CustomEntityVersionPageBlocksActionDataType dataType = CustomEntityVersionPageBlocksActionDataType.RenderDetails)
        {
            if (dataType == CustomEntityVersionPageBlocksActionDataType.UpdateCommand)
            {
                var updateCommandQuery  = new GetUpdateCommandByIdQuery <UpdateCustomEntityVersionPageBlockCommand>(customEntityVersionPageBlockId);
                var updateCommandResult = await _queryExecutor.ExecuteAsync(updateCommandQuery);

                return(_apiResponseHelper.SimpleQueryResponse(updateCommandResult));
            }

            var query = new GetCustomEntityVersionPageBlockRenderDetailsByIdQuery()
            {
                CustomEntityVersionPageBlockId = customEntityVersionPageBlockId, PublishStatus = PublishStatusQuery.Latest
            };
            var results = await _queryExecutor.ExecuteAsync(query);

            return(_apiResponseHelper.SimpleQueryResponse(results));
        }
        public async Task <IActionResult> Get(int pageVersionBlockId, PageVersionRegionBlocksActionDataType dataType = PageVersionRegionBlocksActionDataType.RenderDetails)
        {
            if (dataType == PageVersionRegionBlocksActionDataType.UpdateCommand)
            {
                var updateCommandQuery  = new GetUpdateCommandByIdQuery <UpdatePageVersionBlockCommand>(pageVersionBlockId);
                var updateCommandResult = await _queryExecutor.ExecuteAsync(updateCommandQuery);

                return(_apiResponseHelper.SimpleQueryResponse(this, updateCommandResult));
            }

            var query = new GetPageVersionBlockRenderDetailsByIdQuery()
            {
                PageVersionBlockId = pageVersionBlockId, PublishStatus = PublishStatusQuery.Latest
            };
            var results = await _queryExecutor.ExecuteAsync(query);

            return(_apiResponseHelper.SimpleQueryResponse(this, results));
        }
        public async Task <JsonResult> Get([FromQuery] GetNestedDataModelSchemaByNameRangeQuery rangeQuery)
        {
            if (EnumerableHelper.IsNullOrEmpty(rangeQuery.Names))
            {
                return(_apiResponseHelper.SimpleQueryResponse(Enumerable.Empty <CustomEntityDataModelSchema>()));
            }
            var result = await _domainRepository
                         .WithQuery(rangeQuery)
                         .FilterAndOrderByKeys(rangeQuery.Names)
                         .ExecuteAsync();

            var settings     = _dynamicDataModelSchemaJsonSerializerSettingsCache.GetInstance();
            var jsonResponse = _apiResponseHelper.SimpleQueryResponse(result);

            jsonResponse.SerializerSettings = settings;

            return(jsonResponse);
        }
Esempio n. 17
0
        public async Task <JsonResult> Get([FromQuery] int id)
        {
            IExecutionContext executionContext = await ExecutionContextFactory.CreateAsync();

            PermissionValidationService.EnforceCustomEntityPermission <CustomEntityReadPermission>(BookingCustomEntityDefinition.DefinitionCode, executionContext.UserContext);

            BookingSummary booking = await BookingProvider.GetBookingSummaryById(id);

            return(ApiResponseHelper.SimpleQueryResponse(booking));
        }
Esempio n. 18
0
        public async Task <JsonResult> Get([FromQuery] SearchCustomEntitySummariesQuery query, [FromQuery] GetCustomEntitySummariesByIdRangeQuery rangeQuery)
        {
            if (rangeQuery != null && rangeQuery.CustomEntityIds != null)
            {
                var rangeResults = await _queryExecutor.ExecuteAsync(rangeQuery);

                return(_apiResponseHelper.SimpleQueryResponse(rangeResults.FilterAndOrderByKeys(rangeQuery.CustomEntityIds)));
            }

            if (query == null)
            {
                query = new SearchCustomEntitySummariesQuery();
            }
            ApiPagingHelper.SetDefaultBounds(query);

            var results = await _queryExecutor.ExecuteAsync(query);

            return(_apiResponseHelper.SimpleQueryResponse(results));
        }
        public async Task <IHttpActionResult> Get(int pageId)
        {
            var query = new GetPageVersionSummariesByPageIdQuery()
            {
                PageId = pageId
            };

            var results = await _queryExecutor.ExecuteAsync(query);

            return(_apiResponseHelper.SimpleQueryResponse(this, results));
        }
        public async Task <IHttpActionResult> Get(int customEntityId)
        {
            var query = new GetCustomEntityVersionSummariesByCustomEntityIdQuery()
            {
                CustomEntityId = customEntityId
            };

            var results = await _queryExecutor.ExecuteAsync(query);

            return(_apiResponseHelper.SimpleQueryResponse(this, results));
        }
Esempio n. 21
0
        public async Task <JsonResult> GetLikedCats()
        {
            // Here we get the userId of the currently logged in member. We could have
            // done this in the query handler, but instead we've chosen to keep the query
            // flexible so it can be re-used in a more generic fashion
            var userContext = await _userContextService.GetCurrentContextAsync();

            var query   = new GetCatSummariesByMemberLikedQuery(userContext.UserId.Value);
            var results = await _domainRepository.ExecuteQueryAsync(query);

            return(_apiResponseHelper.SimpleQueryResponse(results));
        }
Esempio n. 22
0
        public async Task<JsonResult> GetAuthSession()
        {
            var member = await _domainRepository.ExecuteQueryAsync(new GetCurrentMemberSummaryQuery());
            var token = _antiforgery.GetAndStoreTokens(HttpContext);

            var sessionInfo = new
            {
                Member = member,
                AntiForgeryToken = token.RequestToken
            };

            return _apiResponseHelper.SimpleQueryResponse(sessionInfo);
        }
Esempio n. 23
0
        public async Task <IActionResult> Get(int pageId, GetPageVersionSummariesByPageIdQuery query)
        {
            if (query == null)
            {
                query = new GetPageVersionSummariesByPageIdQuery();
            }
            query.PageId = pageId;
            ApiPagingHelper.SetDefaultBounds(query);

            var results = await _queryExecutor.ExecuteAsync(query);

            return(_apiResponseHelper.SimpleQueryResponse(this, results));
        }
        public async Task <JsonResult> Get(int customEntityId, GetCustomEntityVersionSummariesByCustomEntityIdQuery query)
        {
            if (query == null)
            {
                query = new GetCustomEntityVersionSummariesByCustomEntityIdQuery();
            }

            query.CustomEntityId = customEntityId;
            ApiPagingHelper.SetDefaultBounds(query);

            var results = await _queryExecutor.ExecuteAsync(query);

            return(_apiResponseHelper.SimpleQueryResponse(results));
        }
Esempio n. 25
0
        public IActionResult Get()
        {
            var results = new List <object>()
            {
                new { Id = 1, Title = "Test 1" },
                new { Id = 2, Title = "Test 2" },
                new { Id = 3, Title = "Test 3" },
                new { Id = 4, Title = "Test 4" },
                new { Id = 5, Title = "Test 5" },
                new { Id = 6, Title = "Test 6" },
                new { Id = 7, Title = "Test 7" },
                new { Id = 8, Title = "Test 8" },
                new { Id = 9, Title = "Test 9" },
                new { Id = 10, Title = "Test 10" }
            };

            return(_apiResponseHelper.SimpleQueryResponse(this, results));
        }
Esempio n. 26
0
        public async Task <JsonResult> Get([FromQuery] GetCustomEntityDataModelSchemaDetailsByDefinitionCodeRangeQuery rangeQuery)
        {
            if (rangeQuery.CustomEntityDefinitionCodes == null)
            {
                return(_apiResponseHelper.SimpleQueryResponse(Enumerable.Empty <CustomEntityDataModelSchema>()));
            }

            var jsonResponse = await _apiResponseHelper.RunWithResultAsync(async() =>
            {
                return(await _domainRepository
                       .WithQuery(rangeQuery)
                       .FilterAndOrderByKeys(rangeQuery.CustomEntityDefinitionCodes)
                       .ExecuteAsync());
            });

            var settings = _dynamicDataModelSchemaJsonSerializerSettingsCache.GetInstance();

            jsonResponse.SerializerSettings = settings;

            return(jsonResponse);
        }
        public async Task <IActionResult> Get(string dataModelName)
        {
            var results = await _queryExecutor.ExecuteAsync(new GetNestedDataModelSchemaByNameQuery(dataModelName));

            return(_apiResponseHelper.SimpleQueryResponse(this, results));
        }
Esempio n. 28
0
 public IActionResult Get()
 {
     return(_apiResponseHelper.SimpleQueryResponse(_youtubeSettings));
 }
Esempio n. 29
0
        public async Task <IActionResult> Get()
        {
            var results = await _queryExecutor.ExecuteAsync(new GetAllPageBlockTypeSummariesQuery());

            return(_apiResponseHelper.SimpleQueryResponse(this, results));
        }
        public async Task <JsonResult> Get([FromBody] SearchBookingSummariesQuery query)
        {
            IList <BookingSummary> bookings = await QueryExecutor.ExecuteAsync(query);

            return(ApiResponseHelper.SimpleQueryResponse(bookings));
        }