Пример #1
0
        public string InputCard()
        {
            List <Body> body = new List <Body>
            {
                new Body
                {
                    type = "TextBlock",
                    text = "UserId"
                },
                new Body  {
                    type        = "Input.Text",
                    id          = "LoginID",
                    placeholder = "enter userid",
                },
                new Body
                {
                    type = "TextBlock",
                    text = "Password"
                },
                new Body  {
                    type        = "Input.Text",
                    id          = "Password",
                    placeholder = "enter password",
                },
            };
            List <Actions> actions = new List <Actions>
            {
                new Actions
                {
                    type  = "Action.Submit",
                    title = "LOGIN"
                }
            };


            var jsonObj = new FlightItinerary
            {
                version = "1.0",
                type    = "AdaptiveCard",
                speak   = "Your flight is confirmed for you and 3 other passengers from San Francisco to Amsterdam on Friday, October 10 8:30 AM",
                body    = body,
                actions = actions
            };



            return(JsonConvert.SerializeObject(jsonObj, Formatting.None,
                                               new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore
            }));
        }
Пример #2
0
 internal static FlightItineraryModel Map(FlightItinerary flightItineraryParam)
 {
     return(new FlightItineraryModel()
     {
         Id = flightItineraryParam.Id,
         TravelDataId = flightItineraryParam.TravelDataId,
         Aeroline = flightItineraryParam.Aeroline,
         DateArraival = flightItineraryParam.DateArraival,
         DateDeparture = flightItineraryParam.DateDeparture,
         DestinationAirport = flightItineraryParam.DestinationAirport,
         FlightCode = flightItineraryParam.FlightCode,
         OriginAirpot = flightItineraryParam.OriginAirpot
     });
 }
        private static IFlightItinerary GetItinerary(SkyscannerBrowseQuoteResponse skyscannerBrowseResponse, ISkyscannerItinerary itinerary)
        {
            if (itinerary == null)
            {
                return(null);
            }
            var stops           = itinerary.CarrierIds?.Length ?? 0;
            var flightItinerary = new FlightItinerary
            {
                NumberOfStops    = GetFlightItineraryNumberOfStops(stops),
                OutboundIataCode = GetOutboundIataCode(skyscannerBrowseResponse, itinerary),
                InboundIataCode  = GetInboundIataCode(skyscannerBrowseResponse, itinerary)
            };

            foreach (var carrier in skyscannerBrowseResponse.Carriers.Where(_ => itinerary.CarrierIds.Contains(_.CarrierId)))
            {
                flightItinerary.AirlineName += carrier.Name;
            }

            return(flightItinerary);
        }
Пример #4
0
        public static Attachment getText(string text)
        {
            List <Body> body = new List <Body>
            {
                new Body
                {
                    type = "TextBlock",
                    text = text
                },
            };


            var jsonObj = new FlightItinerary
            {
                version = "1.0",
                type    = "AdaptiveCard",
                speak   = "Your flight is confirmed for you and 3 other passengers from San Francisco to Amsterdam on Friday, October 10 8:30 AM",
                body    = body
            };



            var Text = JsonConvert.SerializeObject(jsonObj, Formatting.None,
                                                   new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore
            });

            Attachment attachment = new Attachment
            {
                ContentType = AdaptiveCard.ContentType,
                Content     = AdaptiveCard.FromJson(Text).Card
            };

            return(attachment);
        }