public void AddDeviceFeed(DeviceFeed deviceFeed) { using (var db = new CodevelopDBContext()) { db.DeviceFeed.Add(deviceFeed); db.SaveChanges(); } }
private void DispatcherTimer_Tick(object sender, object e) { textBlock.Text = _counter.ToString(); _counter++; try { if (_hubConnection.State == ConnectionState.Connected) { _hubProxy.Invoke("Hello", textBlock.Text); var feedItem = new DeviceFeed { DeviceId = _deviceId, IsHeating = false, IsPumpOn = true, PanelTemp = 78, TankLowerTemp = 45, TankUpperTemp = 63, Timestamp = DateTimeOffset.Now }; _hubProxy.Invoke("SendFeedData", feedItem); } } catch (Exception ex) { LogMessage("Invoke Failed : " + ex.Message); } }
public void SendFeedData(DeviceFeed feed) { Debug.Write("SendFeedData"); DeviceRepository.AddDeviceFeed(feed); }