Example #1
0
        public JsonResult GetAllStations() //Have to be changed so it get parsed in the string for connection
        {
            IMongoCollection <Station> collection = conn.ConnectToStation("Trafik_DB", "Stations");
            var filt = Builders <Station> .Filter.Where(m => m.name != null);

            return(Json(collection.Find(filt).ToList()));
        }
Example #2
0
        public JsonResult GetAllStations() //Have to be changed so it get parsed in the string for connection
        {
            IMongoCollection <Station> collection = conn.ConnectToStation("Trafik_DB", "Stations");
            var filt = Builders <Station> .Filter.Where(m => m.name != null);

            List <Station> stations = collection.Find(filt).ToList();

            List <Result> result = new List <Result>();

            foreach (Station item in stations)
            {
                result.Add(new Result(item.name, item.areacode));
            }
            return(Json(result));
        }
Example #3
0
        public void InsertStation(int areacode, string name, DateTime installed, string equipmentType, double latitude, double longitude)
        {
            IMongoCollection <Station> collection = conn.ConnectToStation("Trafik_DB", "Stations");

            collection.InsertOne(new Station(areacode, name, installed, equipmentType, latitude, longitude));
        }
Example #4
0
        public void InsertStation(string name, int areacode)
        {
            IMongoCollection <Station> collection = conn.ConnectToStation("Trafik_DB", "Stations");

            collection.InsertOne(new Station(name, areacode));
        }