/// <summary> /// 最新公告 /// </summary> /// <param name="noteresult"></param> /// <returns></returns> public ActionResult NoticeResult(int noteresult) { // int noteresult 获取最新的几条 //倒序获取3条公告 viewModel.Notices = NoticeService.GetEntitiesByPage(3, 1, true, r => true, r => r.ModiTime); return(View(viewModel)); }
// 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)); }
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)); }
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)); }