public ActionResult Test() { GoodsManager bll = new GoodsManager(); var list = bll.GetAll(); return(View(list)); }
// GET: Home public ActionResult Index() { GoodsManager bll = new GoodsManager(); var list = bll.GetAll(); // return Redirect("/Admin/Account/Index"); return(View(list)); }
public IHttpActionResult Get() { GoodsManager bll = new GoodsManager(); var list = bll.GetAll(); var list1 = list.Select(x => new { x.GoodsId, x.GoodsName, x.Goods_Type.TypeName }); return(Json(list1)); }
/// <summary> /// 此方法被ajax调用,必须返回json /// 返回json,必须返回匿名类,匿名类集合 /// </summary> /// <returns></returns> public ActionResult GetGoods(int page, int limit) { GoodsManager bll = new GoodsManager(); var list = bll.GetAll(); var list1 = list.Skip((page - 1) * limit).Take(limit).Select(x => new { x.GoodsId, x.GoodsName, x.Goods_Type.TypeName }); var info = new { count = list.Count, code = 0, data = list1 }; return(Json(info, JsonRequestBehavior.AllowGet)); }
public ActionResult Select() { GoodsManager good = new GoodsManager(); List <Goods> lis = good.GetAll(); var lis1 = lis.Select(x => new { x.GoodsId, x.GoodsName, x.Num, x.Price, typeName = x.Goods_Type.TypeName }); return(Json(lis1, JsonRequestBehavior.AllowGet)); }
public ActionResult GetDataWhere(int id, string name) { GoodsManager bll = new GoodsManager(); var list = bll.GetAll(); var list1 = list.Select(x => new { x.GoodsId, x.GoodsName, x.Num, x.Price, x.Goods_Type.TypeName }); var json = new { code = 0, data = list1 }; return(Json(json, JsonRequestBehavior.AllowGet)); }