示例#1
0
        private static string ConvertToXml(ReservationData reservationData)
        {
            StringWriter  textWriter = new StringWriter();
            XmlSerializer x          = new XmlSerializer(reservationData.GetType());

            x.Serialize(textWriter, reservationData);
            return(textWriter.ToString());
        }
示例#2
0
        public string ReturnReservation(String format, String login)
        {
            format = format.ToLower();
            ReservationData reservationData = new ReservationData(login);

            if (format == "xml")
            {
                return(ConvertToXml(reservationData));
            }
            else
            {
                return(ConvertToJson(reservationData));
            }
        }
示例#3
0
        private static string ConvertToJson(ReservationData reservationData)
        {
            string returnJson = JsonConvert.SerializeObject(reservationData);

            return(returnJson);
        }