public async Task <IActionResult> Order(int bookId) { String token = orderBookToken; if (token == null) { var payment = await getToken( new DateRange(DateTime.Today, DateTime.Today.AddDays(2.0)), "OrderBook"); 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 OrderBookRequest(); request.Body = new OrderBookRequestBody(defaultToken, bookId); var result = await client.OrderBookAsync(defaultToken, bookId); if (result.Body.OrderBookResult == false) { return(View("Error")); } return(Redirect("AllBooks")); }
public async Task <IActionResult> Order(int bookId) { LibraryServiceSoapClient.EndpointConfiguration endpointConfiguration = LibraryServiceSoapClient.EndpointConfiguration.LibraryServiceSoap; var client = new LibraryServiceSoapClient(endpointConfiguration); var request = new OrderBookRequest(); request.Body = new OrderBookRequestBody(token, bookId); var result = await client.OrderBookAsync(request); if (result.Body.OrderBookResult == false) { return(View("Error")); } return(Redirect("AllBooks")); }