andrewdavey / andrewdavey/postal
Using FileSystemRazorViewEngine inside controller - Views data are not translated
- Vorherrschende Sprache
- C#
- Sterne
- 534
- Forks
- 164
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Can't we use FileSystemRazorViewEngine from inside the controller? My requirement is to keep the mail template(Views) in a common path and use by mvc application as well as other console or windows application. In this I don't want to keep views inside the mvc app and refer by other application
[HttpPost]
public ActionResult SendSimple()
{
var viewsPath = Server.MapPath("~/Views/Emails");
var engines = new ViewEngineCollection();
engines.Add(new FileSystemRazorViewEngine(viewsPath));
var service = new EmailService(engines);
dynamic email = new Email("Simple");
email.Date = DateTime.UtcNow.ToString(); // This does not get translated into final output
service.Send(email);
return RedirectToAction("Sent", "Home");
}
Same thing work from console application
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.