public DataContract.ReservationListingResponse GetReservationListing(string sessionId, RequestParams requestParams) { using (new ApplicationContextScope(new ApplicationContext())) { ApplicationContext.SetSessionId(sessionId); try { IReservationListingProvider reservationListingProvider = ReservationListingProviderFactory.GetReservationListingProvider(); Model.ReservationListing response = reservationListingProvider.GetReservationListing(requestParams.ToModel()); if (response != null && response.Reservations != null) { DataContract.ReservationListingResponse serviceResponse = response.ToDataContract(); serviceResponse.IsSuccess = true; return serviceResponse; } } catch (Exception exception) { Logger.LogException(exception, Source, "GetReservationListing", Severity.Major); } } return new DataContract.ReservationListingResponse { IsSuccess = false, ErrorMessage = "Failed to get Reservation Listing. Please try again after some time" }; }
public ReservationListingResponse GetReservationListing(string sessionId, RequestParams requestParams) { using (new ApplicationContextScope(new ApplicationContext())) { ApplicationContext.SetSessionId(sessionId); try { var channelFactory = new WebChannelFactory<IAirlinesAdminServiceRest>( Configuration.AirlinesAdminServiceConfigurationName); IAirlinesAdminServiceRest channel = channelFactory.CreateChannel(); if (channel is IContextChannel) using (new OperationContextScope(channel as IContextChannel)) { WebOperationContext.Current.OutgoingRequest.Headers.Add("X-MethodName", "GetReservationListing"); ReservationListingResponse response = channel.GetReservationListing(sessionId, requestParams); if (response != null && response.IsSuccess) { return response; } } } catch (Exception exception) { Logger.LogException(exception, Source, "GetReservationListing", Severity.Major); } } return new ReservationListingResponse { IsSuccess = false, ErrorMessage = "Failed to get Reservation Listing. Please try again after some time" }; }