コード例 #1
0
ファイル: GoodsController.cs プロジェクト: MINDOU520/NB-NB
        public ActionResult GoodsDetails(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Goods        goods         = db.Goods.Find(id);
            GoodsComment goodsComments = db.GoodsComment.Find(id);

            if (goods == null)
            {
                return(HttpNotFound());
            }

            var goodsComment = from m in db.GoodsComment.Where(p => p.GID == id).OrderByDescending(p => p.GCTime) select m;
            var goodsReply   = from m in db.GoodsReply.OrderByDescending(r => r.GRTime) select m;
            var index        = new App.Models.GoodsViewModel
            {
                Goods2        = goods,
                GoodsComment  = goodsComments,
                GoodsComment1 = goodsComment,
                GoodsReply1   = goodsReply,
            };

            return(View(index));
        }
コード例 #2
0
ファイル: GoodsController.cs プロジェクト: MINDOU520/NB-NB
        // GET: Goods
        public ActionResult Index(string searchString)
        {
            var goods           = goodsManager.GetAllGoods();
            var goodsbasketball = goodsManager.Getbasketball();
            var goodsclothes    = goodsManager.Getclothes();
            var goodsshose      = goodsManager.Getshose();
            var goodsprotective = goodsManager.Getprotective();
            var goodsother      = goodsManager.Getother();

            if (!String.IsNullOrEmpty(searchString))
            {
                goods = goods.Where(s => s.GName.Contains(searchString));
            }

            var index = new App.Models.GoodsViewModel
            {
                Goods1     = goods,
                Basketball = goodsbasketball,
                Clothes    = goodsclothes,
                Shose      = goodsshose,
                Protective = goodsprotective,
                Other      = goodsother
            };

            return(View(index));
        }