public static DeviceStatusCommand CreateDeviceStatusCommand(this DeviceStateHistory item) { return(new DeviceStatusCommand(item.DeviceStateId, item.StateName, item.Timestamp, item.Version)); }
public HttpResponseMessage Post([FromBody] DeviceStateHistory deviceStateHistoryInfo) { return(ActionWarpper.Process(deviceStateHistoryInfo, OperationCodes.ADVDRS, () => { var repo = RepositoryManager.GetRepository <IDeviceStateHistoryRepository>(); repo.Insert(deviceStateHistoryInfo); return Request.CreateResponse(HttpStatusCode.OK, deviceStateHistoryInfo); }, this)); }
public HttpResponseMessage Put(int id, [FromBody] DeviceStateHistory deviceStateHistoryInfo) { return(ActionWarpper.Process(deviceStateHistoryInfo, OperationCodes.MDVDRS, () => { deviceStateHistoryInfo.DeviceStateHistoryID = id; var repo = RepositoryManager.GetRepository <IDeviceStateHistoryRepository>(); repo.Update(deviceStateHistoryInfo); return Request.CreateResponse(HttpStatusCode.OK); }, this)); }
public async Task <bool> SaveDeviceState(DeviceStateHistory item) { bool result = true; try { await deviceHistoryCollection.InsertOneAsync(item); } catch { result = false; } return(result); }