<li>
@Html.ActionLink("123", "PayMonthMore", "Home")
</li>
当我按下此按钮时,出现此错误。
我的项目结构是:
控制器
----- HomeController.cs
意见
------首页
---------- Index.cshtml
我的方法代码是:
public ActionResult PayMonthMore()
{
DBModelContainer db = new DBModelContainer();
var user = db.user.First(u => u.username == HttpContext.User.Identity.Name);
var paid = user.paidToDate;
if (paid == null)
{
paid = DateTime.Now;
}
user.paidToDate = paid.Value.AddMonths(1);
db.SaveChanges();
return View();
}