/// once a HttpGet HttpPost
/// MVC how to identify it? Not depend on parameter identification (source parameters too unstable)
/// must be identified by HttpVerbs,
/// If there is no flag, then the method for identifying the name
/// [ChildActionOnly] Action can not be used to specify the individual request, the request can only be a sub
/// [Bind] to specify which fields to receive only from the front, the other not, prevent additional data submitted
/// [ValidateAntiForgeryToken] anti-duplicate submissions, with a key in a cookie, when submitted the first check
[AcceptVerbs(HttpVerbs.Put | HttpVerbs.Post)] //[HttpPost]
//[HttpPost]
//[HttpGet]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "ProductId, CategoryId, Title, Price, Url, ImageUrl")]JDCommodity commodity)
{
string title1 = this.HttpContext.Request.Params["title"];
string title2 = this.HttpContext.Request.QueryString["title"];
string title3 = this.HttpContext.Request.Form["title"];
if (ModelState.IsValid)//数据校验
{
JDCommodity newCommodity = this._iCommodityService.Insert(commodity);
return RedirectToAction("Index");
}
else
{
throw new Exception("ModelState未通过检测");
}
}