// // GET: /Stage/ public ActionResult Index(string id, string name) { ViewBag.SourceAccountId = name; ViewBag.CompanyId = id; Session["CompanyId"] = id; ProductModel pm = new ProductModel(); string RestaurantId = "3F5A7C2E-0B48-4738-B4D0-3848FE943913"; List<RandomProduct> list = pm.getRandomProduct(id,"1"); Session["begindm"] = RestaurantId; return View(list); }
public JsonResult getRandomProduct(string RestaurantId ,string peopleCount ) { ProductModel pm = new ProductModel(); // string CompanyId = Session["CompanyId"] != null ? Session["CompanyId"].ToString() : ""; List<RandomProduct> list = pm.getRandomProduct(RestaurantId, peopleCount); JsonResult json = new JsonResult { Data = list }; json.JsonRequestBehavior = JsonRequestBehavior.AllowGet;//允许get访问,否则报错 return json; }