public async Task <ActionResult> RenderingTemplate([FromBody] NotificationTemplateRequest request, string language) { var template = request.Data.Templates.FindTemplateForLanguage(language); var result = await _notificationTemplateRender.RenderAsync(request.Text, request.Data, template.LanguageCode); return(Ok(new { html = result })); }
public override async Task ToMessageAsync(NotificationMessage message, INotificationTemplateRenderer render) { await base.ToMessageAsync(message, render); var emailMessage = (EmailNotificationMessage)message; var template = (EmailNotificationTemplate)Templates.FindTemplateForLanguage(message.LanguageCode); if (template != null) { emailMessage.Subject = await render.RenderAsync(template.Subject, this, template.LanguageCode); emailMessage.Body = await render.RenderAsync(template.Body, this, template.LanguageCode); } emailMessage.From = From; emailMessage.To = To; emailMessage.CC = CC; emailMessage.BCC = BCC; emailMessage.Attachments = Attachments; }
public override async Task ToMessageAsync(NotificationMessage message, INotificationTemplateRenderer render) { await base.ToMessageAsync(message, render); var smsNotificationMessage = (SmsNotificationMessage)message; var template = (SmsNotificationTemplate)Templates.FindTemplateForLanguage(message.LanguageCode); if (template != null) { smsNotificationMessage.Message = await render.RenderAsync(template.Message, this, template.LanguageCode); } smsNotificationMessage.Number = Number; }