新来的MVC所以学习(在一个失意的一种方式寻找简单的东西,以前需要在web表单5分钟已经变得过于复杂)MVC链接到的意见
所以我成立了VS2015的解决方案它附带先决条件帐户部分。
我还设置了数据库中的表和建立不同于实体(生产一些CRUD
)
这样我就可以登录并(在AccountController
return View("AccountHome")
)
让我AccountHome视图从我AccountHome
页面,我可以用一个单独的控制器
(@Html.ActionLink("Add Foods", "Create", "fad_userFoods", new { id = ViewBag.userID }, new { @class = "btn btn-default" })
)
我在这里做一些形式录入和数据成功添加到数据库导航到另一个看法,但这里是我的问题,李ES。数据录入后,我想回去AccountHome
视图
所以在我的fad_userFoodsControler
我有这样的代码
(return RedirectToAction("AccountHome","Account")
)
- 说资源不能被发现!
在我AccountController
,我有以下代码:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult AccountHome()
{
return View();
}
在我AccountViewModels
我有这样的代码:
public class AccountHomeViewModel
{
public string Email { get; set; }
}
最后,在我的AccountHome.cshtml
页我在上面这个声明(@model FiveADayMVC2.Models.AccountHomeViewModel
)
我哪里错了?看了很多帖子,他们都这样做。我知道该视图存在,因为我可以从登录中获得该视图。然而,如果我手动输入网址(即我的网址后跟/Account/AccountHome
),它不会被发现?
这将是我的缺乏理解,但在哪里?
预先感谢任何指针
你可以通过缩进代码来清理你的问题吗? –