ActivEarth.RestService.ActivEarthRestService.ProcessRoute C# (CSharp) Method

ProcessRoute() public method

public ProcessRoute ( string id, System.Xml.Linq.XElement input ) : string
id string
input System.Xml.Linq.XElement
return string
        public string ProcessRoute(string id, XElement input)
        {
            try
            {
                Route route = new Route()
                {
                    GMTOffset = int.Parse(input.Element("GMTOffset").Value),
                    Distance = double.Parse(input.Element("Distance").Value),
                    EndLatitude = double.Parse(input.Element("EndLatitude").Value),
                    EndLongitude = double.Parse(input.Element("EndLongitude").Value),
                    EndTime = DateTime.Parse(input.Element("EndTime").Value),
                    Mode = input.Element("Mode").Value,
                    Points = input.Element("Points").Value,
                    StartLatitude = double.Parse(input.Element("StartLatitude").Value),
                    StartLongitude = double.Parse(input.Element("StartLongitude").Value),
                    StartTime = DateTime.Parse(input.Element("StartTime").Value),
                    Steps = int.Parse(input.Element("Steps").Value),
                    Type = input.Element("Type").Value,
                    UserId = int.Parse(id)
                };
                string errorMessage;

                int routeId = ActiveRouteDAO.AddNewRoute(route, out errorMessage);

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