Пример #1
0
 private ClimatLog RequestClimatLogToClimatLog(RequestClimatLog requestClimatLog)
 {
     return(new ClimatLog()
     {
         Id = Guid.NewGuid(),
         Date = requestClimatLog.Date.AddHours(3),
         AirHumidity = requestClimatLog.AirHumidity,
         HowOftenId = requestClimatLog.HowOftenId,
         IsRepeatable = requestClimatLog.HowOftenId == 1 ? false : true,
         RoomId = requestClimatLog.RoomId,
         Temperature = requestClimatLog.Temperature
     });
 }
Пример #2
0
        public JsonResult ChangeClimat(RequestClimatLog requestClimatLog)
        {
            Room room = _roomRepository.GetRoomById(requestClimatLog.RoomId);

            if (room != null)
            {
                ClimatLog climatLog = RequestClimatLogToClimatLog(requestClimatLog);
                _roomRepository.ChangeClimat(climatLog);
                return(new JsonResult(new { message = "ok", coffeDeviceState = RoomStateById(requestClimatLog.RoomId) }));
            }
            else
            {
                return(new JsonResult(new
                {
                    message = "error",
                }));
            }
        }