C# mvc view 回到model里的字段
C# mvc view 返回model里的字段
控制器里面的方法是这样子的 (方法写不全)
public ActionResult QuSuccess() {
Models.ShopDomainModel model;
int userId = 31;
int shopId = 5;
Shop.T_ShopDomain shopdomain = shop.GetShopDomain(userId, shopId);
string domain= shopdomain.Domain;//Domain 是视图里的域名 time是绑定时间
DateTime time = shopdomain.CreateTime;
int count = shopdomain.ChangeCount; //更改次数
return View("QuSuccess");
}
视图要返回Domain这个字段的值
(静态页面)要实现的效果如下图

------解决方案--------------------
直接将实体传到页面,
return View("QuSuccess",model );
在view上面使用@model Models.ShopDomainModel
然后就可以取值了@model.Domain
控制器里面的方法是这样子的 (方法写不全)
public ActionResult QuSuccess() {
Models.ShopDomainModel model;
int userId = 31;
int shopId = 5;
Shop.T_ShopDomain shopdomain = shop.GetShopDomain(userId, shopId);
string domain= shopdomain.Domain;//Domain 是视图里的域名 time是绑定时间
DateTime time = shopdomain.CreateTime;
int count = shopdomain.ChangeCount; //更改次数
return View("QuSuccess");
}
视图要返回Domain这个字段的值
(静态页面)要实现的效果如下图
------解决方案--------------------
直接将实体传到页面,
return View("QuSuccess",model );
在view上面使用@model Models.ShopDomainModel
然后就可以取值了@model.Domain