Exemplo n.º 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));
        }
Exemplo n.º 2
0
 // GET: Home
 public ActionResult Index()
 {
     Session["Custid"]         = 1;
     homeviewmodel.Banners     = BannerService.GetEntities(b => true);
     homeviewmodel.NoticeNum   = NoticeService.GetCount(b => true);
     homeviewmodel.Notice      = NoticeService.GetEntitiesByPage(3, 1, false, n => true, n => n.ModiTime);
     homeviewmodel.NewProduct  = ProductService.GetEntitiesByPage(5, 1, false, n => n.Type == 1 && n.Grounding == true, n => n.ModiTime);
     homeviewmodel.ShoppingNum = ShoppingCartService.GetCount(s => s.CusId == (int)Session["Custid"]);
     return(View(homeviewmodel));
 }
Exemplo n.º 3
0
        public ActionResult Index()
        {
            HomeViewModel homeViewModel = new HomeViewModel();

            homeViewModel.NoticeNum = NoticeService.GetCount(n => true);
            homeViewModel.Notices   = NoticeService.GetEntitiesByPage(3, 1, false, n => true, n => n.ModiTime);
            homeViewModel.Banners   = BannerService.GetEntities(b => true);
            homeViewModel.Products  = ProductService.GetEntitiesByPage(3, 1, false, p => p.Type == 1, p => p.ModiTime);

            return(View(homeViewModel));
        }
 /// <summary>
 /// 首页显示
 /// </summary>
 /// <param name="proid"></param>
 /// <returns></returns>
 public ActionResult Index(int proid = 1)
 {
     homeViewModel.NoticeNum = NoticeService.GetCount(n => true);                                                    //公告个数
     homeViewModel.Banners   = BannerService.GetEntities(b => true);                                                 //banner
     homeViewModel.Notices   = NoticeService.GetEntitiesByPage(3, 1, false, m => true, m => m.ModiTime);             //公告
     homeViewModel.Products  = ProductService.GetEntitiesByPage(3, 1, false, p => p.Type == proid, p => p.Moditime); //商品
     homeViewModel.Proid     = proid;                                                                                //热销,推荐,限时
     //addCus(Session["userinfo"] as OAuthUserInfo);//授权登陆
     Session["usid"] = 2;
     return(View(homeViewModel));
 }
Exemplo n.º 5
0
        public ActionResult Index()
        {
            viewModel.NoticeNum = NoticeService.GetCount(r => true);                                        //主页显示的公告数量
            viewModel.Notices   = NoticeService.GetEntitiesByPage(3, 1, false, r => true, r => r.ModiTime); //公告

            //b => true 获取所有的Banner实体集
            viewModel.Banners = BannerService.GetEntities(b => true);//Banner

            viewModel.Products = ProductService.GetEntitiesByPage(3, 1, true, p => true, p => p.ModiTime);


            //作为强类型传到前台页面 然后用Model打点调用该实体集内所获取到的Banner集合
            return(View(viewModel));
        }