Esempio n. 1
0
        /// <summary>
        /// Reset the MongoDB database.
        /// </summary>
        public void ClearMongo()
        {
            var controller = new MongoRepository();
            controller.ClearMongo();

            DebugOutput.Print("MongoDB Database dropped successfully.");
        }
        /// <summary>
        /// Creates a new Device object within the database.
        /// </summary>
        /// <param name="device"></param>
        public DOM.Device CreateDevice(DOM.Device device)
        {
            var dbVal = _mapper.Map(device, new DAL.Device());
            _db.Devices.Add(dbVal);
            _db.SaveChanges();

            //Update MongoDB accordingly
            var mongorepo = new MongoRepository();
            mongorepo.AddNewDevice(device);
            //MongoDB Updated!

            return _mapper.Map(dbVal, new DOM.Device());
        }
Esempio n. 3
0
 public ICollection<Value> GetValuesForDevice(Device device)
 {
     var repo = new MongoRepository();
     return repo.GetAllValuesForDevice(device.Id);
 }