public TicketInformationApiResponseModel GetTicketInformation(TicketBasicInformationApiRequestModel ticketBasicInformationApiRequestModel) { var client = new HttpClient { BaseAddress = new Uri(_url + "/ticket?id=1") }; var response = client.GetAsync(client.BaseAddress).GetAwaiter().GetResult().Content.ReadAsStringAsync().Result; var ticket = JsonConvert.DeserializeObject <dynamic>(response); var ticketInformationModel = new TicketInformationApiResponseModel { StartingStation = ticket.Tickets[0].Route.StacjaPoczatkowa.Nazwa, EndingStation = ticket.Tickets[0].Route.StacjaKoncowa.Nazwa, //IntermediateStations = ticket.Route.StacjePosrednie.ToList(), Distance = ticket.Tickets[0].Route.Dlugosc, TrainName = ticket.Tickets[0].Train.NazwaPociagu, QuantityOfCarriages = ticket.Tickets[0].Train.Wagony }; return(ticketInformationModel); }
public TicketInformationApiResponseModel GetTicketInformation([FromBody] TicketBasicInformationApiRequestModel ticketBasicInformationApiRequestModel) { return(_ticketService.GetTicketInformation(ticketBasicInformationApiRequestModel)); }