コード例 #1
0
        public void AddTempalte(EmailTemplate template)
        {
            var oldTemplate = GetTemplate(template.Name);

            if (oldTemplate != null)
            {
                UpdateTemplate(template);
            }
            else
            {
                _dataBase.Add(template);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: haimtz/Moshavit-Server
        private static void LoadTemplateMail()
        {
            Console.WriteLine("Load Forgot password email template....");
            var service = _resolver.Resolver<ITemplateService>();
            var path = Path.Combine(Environment.CurrentDirectory, "forgotmail.html");
            var content = File.ReadAllText(path);

            var emaiTemplate = new EmailTemplate
            {
                Name = MailConst.Template.FORGOT_PASSWORD,
                Content = content
            };

            service.AddTempalte(emaiTemplate);

            Console.WriteLine("Load welcome email template....");
            path = Path.Combine(Environment.CurrentDirectory, "welcomemail.html");
            content = File.ReadAllText(path);

            emaiTemplate.Name = MailConst.Template.WELCOM_MAIL;
            emaiTemplate.Content = content;

            service.AddTempalte(emaiTemplate);
        }
コード例 #3
0
 public void UpdateTemplate(EmailTemplate template)
 {
     var oldTemplate = GetTemplate(template.Name);
     template.Id = oldTemplate.Id;
     _dataBase.Update(template);
 }