Beispiel #1
0
        public ActionResult Insert(float x, float y)
        {
            float x1     = x;
            float y1     = y;
            var   marker = new Marker()
            {
                Longitude = x, Latitude = y
            };

            db.Marker.Add(marker);
            db.SaveChanges();
            return(Json(new { x = x1, y = y1 }, JsonRequestBehavior.AllowGet));
        }
        public MarkerController(MarkerContext context)
        {
            _context = context;

            if (_context.Markers.Count() == 0)
            {
                // Create a new TodoItem if collection is empty,
                // which means you can't delete all TodoItems.
                _context.Markers.Add(new Marker {
                    PollutionDate = new DateTime(), AddressName = "", Latitude = 0m, Longitude = 0m,
                    NO2Mean       = 0f, NO2MaxValue = 0, NO2MaxHour = 0, NO2AQI = 0,
                    O3Mean        = 0f, O3MaxValue = 0, O3MaxHour = 0, O3AQI = 0,
                    SO2Mean       = 0f, SO2MaxValue = 0, SO2MaxHour = 0, SO2AQI = 0,
                    COMean        = 0f, COMaxValue = 0, COMaxHour = 0, COAQI = 0
                });
                _context.SaveChanges();
            }
        }