/// <summary> /// Method to update the timer /// </summary> /// <param name="v"></param> /// <param name="newTime"></param> /// <returns></returns> public TimerModel UpdateTimer(int v, TimerModel newTime) { TimerModel toChange = _context.ActiveTime.Find(v); if (toChange == null) { return(null); } toChange.ActiveEnd = newTime.ActiveEnd; toChange.ActiveStart = newTime.ActiveStart; toChange.TimerActive = newTime.TimerActive; _context.SaveChanges(); return(toChange); }
/// <summary> /// Method to Add to Pir-table /// </summary> /// <param name="value"></param> //TODO validate data public MotionModel Add(MotionModel value) { _context.MotionList.Add(value); _context.SaveChanges(); return(value); }
/// <summary> /// Method to add sensor to Sensor-table /// </summary> /// <param name="newSens">Object to add</param> /// <returns>Added object</returns> public SensorModel Add(SensorModel newSens) { _context.SensorList.Add(newSens); _context.SaveChanges(); return(newSens); }