コード例 #1
0
        // GET: Home
        public ActionResult Index()
        {
            HomeViewModel homeViewModel = new HomeViewModel();

            homeViewModel.NoticeNum = NoticeService.GetCount(n => true);
            homeViewModel.Banners   = BannerService.GetEntities(b => true);
            homeViewModel.Notices   = NoticeService.GetEntitiesByPpage(3, 1, false, n => true, n => n.ModiTime);

            homeViewModel.Prod1 = ProductService.GetEntitiesByPpage(3, 1, false, n => n.Type == 1, n => n.CreateTime);
            homeViewModel.Prod2 = ProductService.GetEntitiesByPpage(3, 1, false, n => n.Type == 2, n => n.CreateTime);
            homeViewModel.Prod3 = ProductService.GetEntitiesByPpage(3, 1, false, n => n.Type == 3, n => n.CreateTime);

            homeViewModel.user = Session["userinfo"] as OAuthUserInfo;
            //homeViewModel.caresum= ShopCartService.GetCount(n => n.CusId == 1);
            //Session["cartNum"] = homeViewModel.caresum;

            //homeViewModel.tid = i;
            //addCus(homeViewModel.user);
            Session["openid"] = "oWY-Owxt2VJAiHNj23fdowUP0olE";
            var cus = CustomerService.GetEntity(n => n.OpenId == Session["openid"].ToString());

            //cus.Phone = "";
            //CustomerService.Add(cus);
            Session["cusId"] = cus.ID;
            Session["tel"]   = cus.Phone;
            return(View(homeViewModel));
        }