(string name, string subject, Dictionary<string, string>? properties)
| 10 | private readonly Dictionary<string, string> _templates = new(); |
| 11 | |
| 12 | public async Task<string> Render(string name, string subject, Dictionary<string, string>? properties) |
| 13 | { |
| 14 | var baseTemplate = await GetTemplate("Base"); |
| 15 | var emailTemplate = await GetTemplate(name); |
| 16 | |
| 17 | if (properties is not null) |
| 18 | { |
| 19 | foreach (var (key, value) in properties) |
| 20 | emailTemplate = emailTemplate.Replace($"##{key.ToUpper()}##", HttpUtility.HtmlEncode(value)); |
| 21 | } |
| 22 | |
| 23 | return baseTemplate.Replace("##SUBJECT##", subject).Replace("##BODY##", emailTemplate); |
| 24 | } |
| 25 | |
| 26 | public async Task<string> GetTemplate(string name) |
| 27 | { |
no outgoing calls
no test coverage detected