public void AddTimer(Storage.Timers timer) { using (var context = new DatabaseContext()) { context.Timers.Add(timer); context.SaveChanges(); } }
public void RemoveTimer(Storage.Timers timer) { using (var context = new DatabaseContext()) { var dbTimer = context.Timers.SingleOrDefault(t => t.TimersId == timer.TimersId); if (dbTimer != null) { context.Timers.Remove(dbTimer); context.SaveChanges(); } } }