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"); }
时间: 2024-10-03 08:29:30