ActivEarth.RestService.ActivEarthRestService.AddCarpool C# (CSharp) Метод

AddCarpool() публичный Метод

public AddCarpool ( System.Xml.Linq.XElement input ) : string
input System.Xml.Linq.XElement
Результат string
        public string AddCarpool(XElement input)
        {
            try
            {
                Carpool carpool = new Carpool()
                {
                    Start = input.Element("Start").Value,
                    Destination = input.Element("Destination").Value,
                    SeatsAvailable = byte.Parse(input.Element("SeatsAvailable").Value),
                    Time = input.Element("Time").Value,
                    Comments = input.Element("Comments").Value,
                    UserId = int.Parse(input.Element("UserId").Value)
                };
                string errorMessage;

                int carpoolId = CarpoolDAO.AddCarpool(carpool, out errorMessage);

                return "Carpool addition was " + (carpoolId > 0 ? "successful." : ("unsuccessful. Reason: " + errorMessage));
            }
            catch (Exception e)
            {
                return String.Format("Carpool addition was unsuccessful. Reason: {0}", e.Message);
            }
        }