我正在使用 MVC Mailer - 我的控制器中有这个:
//
// POST: /ExhibitorInterest/Create
[HttpPost]
public ActionResult Create(ExhibitorInterest exhibitorinterest)
{
if (ModelState.IsValid)
{
db.ExhibitorInterests.Add(exhibitorinterest);
db.SaveChanges();
UserMailer.ExhibitorInterest().Send();
return RedirectToAction("Thankyou");
}
return View(exhibitorinterest);
}
但我想将模型参展商兴趣传递给邮件视图:
UserMailer.cs 有:
public virtual MvcMailMessage ExhibitorInterest()
{
//ViewBag.Data = someObject;
return Populate(x =>
{
x.Subject = "ExhibitorInterest";
x.ViewName = "ExhibitorInterest";
x.To.Add("me@myemail.co.uk");
});
}
任何想法如何让参展商对 UserMailer.cs 感兴趣 - 所以我可以将它添加到邮件视图中吗?
谢谢,
标记