示例#1
0
        private async Task AdvancedSearchAsync()
        {
            ConsoleHelper.ShowHeading("Advanced search of superstars");

            string propertiesToSearch = "IDSuperstar,Name,HeightCm,WeightKg,Gender.Name,Brand.Name,City.Name,City.Country.Name";

            QueryCriteriaRequestDto queryCriteriaRequestDto = ConsoleHelper.GetQueryCriteriaRequest(propertiesToSearch);

            await ConsoleHelper.RunWithTryCatchAsync(async() =>
            {
                PagedResponseDto <SuperstarReadDto> pagedResponseDto = await _superstarApi.GetAllAsync(queryCriteriaRequestDto);
                ConsoleHelper.ShowPagedResponse(pagedResponseDto);
            }, "An Error occurred while retriving data.");
        }
示例#2
0
        private async Task AdvancedSearchAsync()
        {
            ConsoleHelper.ShowHeading("Advanced search of cities");

            string propertiesOfSearch = "IDCity,Name,Country.Name";

            QueryCriteriaRequestDto queryCriteriaRequestDto = ConsoleHelper.GetQueryCriteriaRequest(propertiesOfSearch);

            await ConsoleHelper.RunWithTryCatchAsync(async() =>
            {
                PagedResponseDto <CityReadDto> pagedResponseDto = await _cityApi.GetAllAsync(queryCriteriaRequestDto);
                ConsoleHelper.ShowPagedResponse(pagedResponseDto);
            }, "An error occurred while retriving data.");
        }
示例#3
0
        public static void ShowPagedResponse <TReadDto>(PagedResponseDto <TReadDto> pagedResponseDto)
        {
            Console.WriteLine();
            ShowHeading("Response");

            if (pagedResponseDto.IsSuccessful)
            {
                Console.WriteLine($"Page index: {pagedResponseDto.PagedList.PageIndex}");
                Console.WriteLine($"Page size: {pagedResponseDto.PagedList.PageSize}");
                Console.WriteLine($"Total count: {pagedResponseDto.PagedList.TotalCount}");
                Console.WriteLine($"Total pages: {pagedResponseDto.PagedList.TotalPages}");
                Console.WriteLine($"Has previous: {pagedResponseDto.PagedList.HasPrevious}");
                Console.WriteLine($"Has next: {pagedResponseDto.PagedList.HasNext}");
                Console.WriteLine();

                ShowTable(pagedResponseDto.PagedList.Subset, pagedResponseDto.PropertyInfoListOfDto);
                ShowGreenMessage(pagedResponseDto.Message);
            }
            else
            {
                ShowRedMessage(pagedResponseDto.Message);
            }
        }