Ejemplo n.º 1
0
        public async Task <MailConfigDto> InsertOrUpdateConfig(MailConfigDto mailConfigDto)
        {
            MailConfigEntity mailConfigEntity = MapToMailEntity(mailConfigDto);
            TableOperation   operation        = TableOperation.InsertOrMerge(mailConfigEntity);
            TableResult      result           = await _mailConfigTable.ExecuteAsync(operation);

            MailConfigDto mailConfig = MapToMailConfigDto(result.Result as MailConfigEntity);

            return(mailConfig);
        }
Ejemplo n.º 2
0
        private MailConfigEntity MapToMailEntity(MailConfigDto mailConfig)
        {
            MailConfigEntity mailConfigEntity = new MailConfigEntity(mailConfig.Name);

            mailConfigEntity.Name            = mailConfig.Name;
            mailConfigEntity.Type            = mailConfig.Type;
            mailConfigEntity.TemplateId      = mailConfig.TemplateId;
            mailConfigEntity.IntervalSeconds = mailConfig.IntervalSeconds;
            mailConfigEntity.LastSend        = mailConfig.LastSend;
            mailConfigEntity.NextSend        = mailConfig.NextSend;
            return(mailConfigEntity);
        }
Ejemplo n.º 3
0
        public async Task <MailConfigDto> LoadConfig(string mailName)
        {
            TableOperation operation = TableOperation.Retrieve <MailConfigEntity>(_mailConfigPartitionKey, mailName);
            TableResult    result    = await _mailConfigTable.ExecuteAsync(operation);

            MailConfigEntity mailConfig = result.Result as MailConfigEntity;

            if (mailConfig != null)
            {
                MailConfigDto mailConfigDto = MapToMailConfigDto(mailConfig);
                return(mailConfigDto);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
        private MailConfigDto MapToMailConfigDto(MailConfigEntity mailConfig)
        {
            MailConfigDto mailConfigDto = new MailConfigDto(mailConfig.Name, mailConfig.Type, mailConfig.TemplateId, mailConfig.IntervalSeconds, mailConfig.LastSend.Value, mailConfig.NextSend.Value);

            return(mailConfigDto);
        }