您的位置:首页 > 其它

FormCollection的用法

2015-10-07 11:12 357 查看
FormCollection的用法:

有时候前台抛来的字段太多,在后台一个一个例举出来显得麻烦,而且还容易出错,FormCollection解决了这个烦恼

#region 给商家留言
[HttpPost]
public ActionResult LeaveMessage(FormCollection fc)
{
bool result = false;
UserShopMessage userShopMessage = new UserShopMessage()
{
UID=Net.ConvertHelper.ToInt(fc["uid"]),
ShopsID=Net.ConvertHelper.ToInt(fc["shopsid"]),
ProductName=fc["productName"],
ProductImageUrl=fc["productImage"],
PRID=Net.ConvertHelper.ToInt(fc["prid"]),
MessageType=0,
Message=fc["message"],
IsRead=0,
CreateTime=DateTime.Now
};
result = ProductList.Instance.AddLeaveMessage(userShopMessage);
return Content(result ? "ok" : "error");
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: