我正在尝试返回Viewmodel值,但我无法在视图中获取它们
这是我的代码
public ActionResult Please(string id)
{
UserViewModel mo = new UserViewModel();
mo.WriterName = "aaa";
return View(mo);
}
答案 0 :(得分:-1)
在你的视图上试试这个
@model [Namespace].UserViewModel
@{
ViewBag.Title = "My Title";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>@Model.WriterName</h2>