コード例 #1
0
        public ActionResult Test()
        {
            GoodsManager bll = new GoodsManager();

            var list = bll.GetAll();

            return(View(list));
        }
コード例 #2
0
        // GET: Home

        public ActionResult Index()
        {
            GoodsManager bll = new GoodsManager();

            var list = bll.GetAll();

            // return Redirect("/Admin/Account/Index");
            return(View(list));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        /// <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));
        }
コード例 #5
0
ファイル: HomeController.cs プロジェクト: yxyzka/onegit
        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));
        }
コード例 #6
0
        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));
        }