public void AddOrUpdate(Models.MagicMirror magicMirror) { //find magicMirror in _cache var mirror = _cache.Where(m => m.BleAddress == magicMirror.BleAddress).FirstOrDefault(); if (mirror != null) { mirror.Ip = magicMirror.Ip; mirror.SelectedNetwork = magicMirror.SelectedNetwork; } else { _cache.Add(magicMirror); } SaveChanges(); }
public void Remove(Models.MagicMirror magicMirror) { _cache.Remove(magicMirror); SaveChanges(); }