public async Task <IActionResult> AllAvailableBooks()
        {
            String token = getAllBooksToken;

            if (token == null)
            {
                var payment = await getToken(
                    new DateRange(DateTime.Today, DateTime.Today.AddDays(2.0)), "GetAllBooks");

                if (payment is ErrorViewModel)
                {
                    return(View("~/Views/Shared/Error.cshtml", payment));
                }
                token = payment as String;
            }

            LibraryServiceSoapClient.EndpointConfiguration endpointConfiguration = LibraryServiceSoapClient.EndpointConfiguration.LibraryServiceSoap;
            var client  = new LibraryServiceSoapClient(endpointConfiguration);
            var request = new GetAllAvailableBooksRequest();

            request.Body = new GetAllAvailableBooksRequestBody(token);

            var result = await client.GetAllAvailableBooksAsync(token);

            if (result.Body.GetAllAvailableBooksResult == null || result.Body.GetAllAvailableBooksResult.Length == 0)
            {
                return(View("Error"));
            }
            return(View(result.Body.GetAllAvailableBooksResult.ToList()));
        }
Пример #2
0
        public async Task <IActionResult> AllAvailableBooks()
        {
            LibraryServiceSoapClient.EndpointConfiguration endpointConfiguration = LibraryServiceSoapClient.EndpointConfiguration.LibraryServiceSoap;
            var client  = new LibraryServiceSoapClient(endpointConfiguration);
            var request = new GetAllAvailableBooksRequest();

            request.Body = new GetAllAvailableBooksRequestBody(token);

            var result = await client.GetAllAvailableBooksAsync(request);

            if (result.Body.GetAllAvailableBooksResult == null || result.Body.GetAllAvailableBooksResult.Length == 0)
            {
                return(View("Error"));
            }
            return(View(result.Body.GetAllAvailableBooksResult.ToList()));
        }