我在var u = new utility()和var eamil上设置了断点。我一直在收到消息。 "断点当前不会被击中。没有为此代码位置加载代码" actionResult始终返回一个有效的模型,并允许代码处理,即使表单上没有输入任何信息。
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult prayerrequest(prayerRequstViewModel request)
{
if (ModelState.IsValid)
{
var u = new utility();
var email = u.sendEmail(request);
if(email == "true")
{
TempData["notice"] = "Success! Your prayer request has been successfully submitted.";
return Redirect("~/Contactus/prayerrequest");
}
else
{
TempData["notice"] = email;
}
}
return View();
}