[WONT RUN] RazorEngine
This commit is contained in:
parent
1a9fc24ba9
commit
5f188c99a8
7 changed files with 292 additions and 9237 deletions
29
cli/Modules/MonthlyEMailGenerator.cs
Normal file
29
cli/Modules/MonthlyEMailGenerator.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using RazorEngine.Templating;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Services;
|
||||
|
||||
namespace cli.Modules
|
||||
{
|
||||
public class MonthlyEMailGenerator : IModule
|
||||
{
|
||||
IRazorEngineService engine;
|
||||
IEmailSender emailSender;
|
||||
|
||||
ApplicationDbContext dbContext;
|
||||
public MonthlyEMailGenerator(ApplicationDbContext context, IRazorEngineService res, IEmailSender sender)
|
||||
{
|
||||
dbContext = context;
|
||||
engine = res;
|
||||
emailSender = sender;
|
||||
// engine.AddTemplate(new Tem)
|
||||
}
|
||||
public void Run(string[] args)
|
||||
{
|
||||
Console.WriteLine($"Hello from second module using {engine}");
|
||||
string template = "Hello @Model.Name, welcome to RazorEngine!";
|
||||
var result = engine.RunCompile(template, "templateKey", null, new { Name = "World" });
|
||||
Console.WriteLine(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue