Example #1
0
        //
        // GET: /Device/Create

        public JsonResult Create(string name, string longitude, string latitude)
        {
            MapService.AjaxMapServiceSoapClient service = new MapService.AjaxMapServiceSoapClient();
            var device = service.AddDevice(name, longitude, latitude);

            service.Close();
            return(Json(new { state = "Success", data = new { name = device.Name, longitude = device.Longitude, latitude = device.Latitude }, code = 200 },
                        JsonRequestBehavior.AllowGet));
        }
Example #2
0
        //
        // GET: /Device/Details/5

        public JsonResult Details(int id)
        {
            MapService.AjaxMapServiceSoapClient service = new MapService.AjaxMapServiceSoapClient();
            var device = service.GetDeviceById(id);

            service.Close();
            return(Json(
                       new { state = "Success", data = new { name = device.Name, longitude = device.Longitude, latitude = device.Latitude }, code = 200 },
                       JsonRequestBehavior.AllowGet
                       ));
        }
Example #3
0
        //
        // GET: /Device/

        public JsonResult Index()
        {
            MapService.AjaxMapServiceSoapClient service = new MapService.AjaxMapServiceSoapClient();
            var data = service.Devices().Select(s => new { name = s.Name, latitude = s.Latitude, longitude = s.Longitude });

            service.Close();
            return(Json(
                       new { state = "Success", data = data, code = 200 },
                       JsonRequestBehavior.AllowGet
                       ));
        }