/// <summary> /// Endpoint to get all locations /// </summary> /// <param name="xml"></param> /// <returns></returns> public XElement GetAllLocations() { NamingServiceClient namingClient = new NamingServiceClient(); XElement result = namingClient.GetAllLocations(); namingClient.Close(); XElement response = GetResponseInfo(new XElement("Response"), "OK", "OK"); response.Add(new XElement("Platser", result.Element("Locations").Elements("Location").Select(x => new XElement("Plats", new XElement("PlatsEPC", x.Element("Epc").Value), new XElement("PlatsNamn", x.Element("Name").Value) )) )); return response; }
// GET: Vehicle public ActionResult Index() { NamingServiceClient namingService = new NamingServiceClient(); // VehicleServiceClient vehicleService = new VehicleServiceClient(); XElement xmlResponse = namingService.GetAllLocations(); List <string> locationList = (from location in xmlResponse.Descendants("Location") select location.Element("Name").Value).ToList(); List <SelectListItem> listOfLocations = new List <SelectListItem>(); foreach (var a in xmlResponse.Descendants("Location")) { listOfLocations.Add(new SelectListItem { Text = a.Element("Name").Value.ToString(), Value = a.Element("Name").Value.ToString() + "*" + a.Element("Epc").Value.ToString() }); } ViewBag.ListOfLocations = listOfLocations; // (DateTime start, DateTime end, String locationEPC, string location, string user) DateTime start = new DateTime(2011, 03, 25); DateTime end = new DateTime(2011, 03, 28); String locationEPC = "urn:epc:id:sgln:735999271.000.12"; string locationn = "Göteborg"; string user = "******"; // XElement xmlTest = vehicleService.XmlAnswer(start, end, locationEPC, locationn, user); return(View()); }
public XElement HämtaAllaPlatser() { XElement allaPlatser = namingClient.GetAllLocations(); return(allaPlatser); }