Beispiel #1
0
        private void SendRequestEmail(string requesterEmail, TemperatureRequest request)
        {
            string sendTo = _airFlowHelper.GetSingleContentPropertyValue <string>("Home", "supportEmailAddress");

            _logger.Debug($"SendRequestTo: {sendTo}");
            var options = new TemperatureRequestEmailMessageOptions(
                sendTo,
                request.AirConditionUnitName,
                requesterEmail,
                request.Temperature,
                request.RequestDateTime.Value);

            _emailSender.Send(EmailMessageType.TemperatureChangeRequest, options);
        }
Beispiel #2
0
        public Result CreateRequest(string requesterEmail, TemperatureRequest request)
        {
            try
            {
                SendRequestEmail(requesterEmail, request);
                var requestDto = new AirConditionUnitRequestDto
                {
                    AirConditionUnitId = request.AirConditionUnitId,
                    RequesterEmail     = requesterEmail,
                    Temperature        = request.Temperature,
                    UpdateDateTime     = request.RequestDateTime.Value
                };

                _logger.Debug(requestDto.ToString());
                _repository.Save(requestDto);

                return(Result.Success);
            }
            catch (Exception e)
            {
                _logger.Error("Failed to create request", e);
                return(new Result(ErrorCodeType.UnknownError));
            }
        }