/// <summary> /// 新增商品界面 /// </summary> /// <returns></returns> public ActionResult AddGoods() { Session["li_1"] = 1; Session["li_2"] = 1; //查询所有最小的分类 List <TypeTable> typelist = TypeTableBll.SelectSmallType().Select(p => new TypeTable { TypeID = p.TypeID, TypeName = p.TypeName }).ToList(); Session["smalltype"] = typelist; return(View()); }
/// <summary> /// 查询一个商品的详情 /// </summary> /// <param name="GoodsID">商品id</param> /// <returns></returns> public JsonResult GoodsDesc(string GoodsID) { //查询商品的信息 GoodsTable good = GoodsBll.SelectAllGoods().SingleOrDefault(p => p.GoodsID == Convert.ToInt32(GoodsID)); //查询商品对应的所有图片 var goodsphoto = GoodsPhotoBll.SelectAllGoodsPhoto().Where(p => p.GoodsID == Convert.ToInt32(GoodsID)).Select(p => new { RID = p.RID, GoodsID = p.GoodsID, PhotoPath = p.PhotoPath }).ToList(); //查询所有最小的分类 var typelist = TypeTableBll.SelectSmallType().Select(p => new { typeid = p.TypeID, typename = p.TypeName }); JsonSerializerSettings jsonstring = new JsonSerializerSettings(); jsonstring.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; string list_1 = JsonConvert.SerializeObject(good, jsonstring); string list_2 = JsonConvert.SerializeObject(goodsphoto, jsonstring); string list_3 = JsonConvert.SerializeObject(typelist, jsonstring); return(Json(new { Good = list_1, GoodPhoto = list_2, GoodType = list_3 }, JsonRequestBehavior.AllowGet)); }