Exemple #1
0
        private async Task LoadData(int pageNumber, int pageSize)
        {
            var request = new FlightsRequest {
                PageSize = pageSize, PageNumber = pageNumber + 1
            };
            var response = await _flightsRepo.GetTicketFormPdf(request);

            totalItems  = response.TotalCount;
            currentPage = response.CurrentPage;
            var data = response.Data;

            data = data.Where(element =>
            {
                if (string.IsNullOrWhiteSpace(searchString))
                {
                    return(true);
                }
                if (element.appCode.Contains(searchString, StringComparison.OrdinalIgnoreCase))
                {
                    return(true);
                }
                if (element.empName.Contains(searchString, StringComparison.OrdinalIgnoreCase))
                {
                    return(true);
                }
                if (element.orderId.Contains(searchString, StringComparison.OrdinalIgnoreCase))
                {
                    return(true);
                }
                return(false);
            }).ToList();
            pagedData = data;
        }
Exemple #2
0
        public async Task <PaginatedResult <FlightsResponse> > GetTicketFormPdf(FlightsRequest flightsRequest)
        {
            var request    = new HttpRequestMessage(HttpMethod.Get, Endpoints.FlightGetTicketFormPdfEndpoint);
            var client     = _client.CreateClient();
            var savedToken = await this._localStorage.GetItemAsync <string>("authToken");

            if (!string.IsNullOrWhiteSpace(savedToken))
            {
                request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", savedToken);
            }
            HttpResponseMessage response = await client.SendAsync(request);

            var content = await response.Content.ReadAsStringAsync();

            var result = JsonConvert.DeserializeObject <PaginatedResult <FlightsResponse> >(content);

            return(result);
        }