public void AddTempalte(EmailTemplate template) { var oldTemplate = GetTemplate(template.Name); if (oldTemplate != null) { UpdateTemplate(template); } else { _dataBase.Add(template); } }
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); }
public void UpdateTemplate(EmailTemplate template) { var oldTemplate = GetTemplate(template.Name); template.Id = oldTemplate.Id; _dataBase.Update(template); }