//详情 public ActionResult Detail(int id, int classid) { var good = GoodsManage.Getgood(id); var classif = GoodsManage.FindAllBooks().Where(p => p.Classify_id == classid); var Comment = CommentGoodsManage.findallcomment(id); var userid = Convert.ToInt32(Session["User_id"]); ViewModels.GoodsDetail index = new GoodsDetail(); if (userid > 0) { var carts = CartManage.Findusercart(userid); index.Carts1 = carts; } if (good == null) { return(HttpNotFound()); } if (classif == null) { return(HttpNotFound()); } if (Comment == null) { return(HttpNotFound()); } index.Goodss = good; index.Goods11 = classif; index.Comment1 = Comment; return(View(index)); //return View(); }
public ActionResult selectGood(string searchString, string SortInfoFrom) { var good = GoodsManage.selectGoods(); var tugood = GoodsManage.FindGoods().Take(3); if (!String.IsNullOrEmpty(searchString)) { good = good.Where(s => s.GoodsDes.Contains(searchString) || s.GoodsName.Contains(searchString) || s.Classify.ClassifyName.Contains(searchString)); } if (!String.IsNullOrEmpty(SortInfoFrom)) { if (SortInfoFrom == "价格降序") { good = good.OrderByDescending(p => p.GoodsPrice); } else if (SortInfoFrom == "价格升序") { good = good.OrderBy(p => p.GoodsPrice); } else if (SortInfoFrom == "更新时间") { good = good.OrderByDescending(p => p.Grounding); } } SelectGoods inde = new SelectGoods(); inde.good1 = good; inde.good2 = tugood; return(View(inde)); }
// GET: Personal public ActionResult Index(int id) { var users = PersonalManage.FinduserId(id); var goodss = GoodsManage.FindAllBooks().OrderByDescending(p => p.Grounding).Take(6); var cart = PersonalManage.findcart(id).OrderByDescending(p => p.Addtime).Take(2); ViewModels.Personal index = new ViewModels.Personal() { userde = users, Good1 = goodss, cart1 = cart }; HttpContext.Session["User_id"] = id; ViewBag.cartcount = PersonalManage.findcarticount(id); return(View(index)); }
// GET: Brave public ActionResult Index() { var news = BraveManage.FindAllNews().OrderByDescending(p => p.SubmtDate).Take(4); var video = BraveManage.FindAllvideo().OrderByDescending(p => p.MilitaryVideoTime).Take(4); var video1 = BraveManage.FindAllvideo1().OrderByDescending(p => p.VideoTime).Take(3); var history1 = BraveManage.FindAllhistory().OrderByDescending(p => p.HistoryTime).Take(10); var goodss = GoodsManage.FindAllBooks().OrderByDescending(p => p.Grounding).Take(3); var spots = BraveManage.FindAllSpots().OrderByDescending(p => p.RedSpotsName).Take(3); var share = BraveManage.FindAllShare().OrderByDescending(p => p.RedShareTime).Take(4); ViewModels.Brave index = new ViewModels.Brave(); index.new1 = news; index.Video = video; index.Video1 = video1; index.history = history1; index.Good1 = goodss; index.spots1 = spots; index.Share = share; return(View(index)); }
// GET: Malls public ActionResult Index() { var good = GoodsManage.FindAllBooks().OrderByDescending(p => p.Grounding).Take(8); var Zhanji = GoodsManage.FindAllBooks().Where(b => b.Classify_id == 1).Take(6); var Qiang = GoodsManage.FindAllBooks().Where(c => c.Classify_id == 4).Take(6); var Hangmu = GoodsManage.FindAllBooks().Where(a => a.Classify_id == 3).Take(6); var Feixing = GoodsManage.FindAllBooks().Where(d => d.Classify_id == 2).Take(6); var Tanke = GoodsManage.FindAllBooks().Where(e => e.Classify_id == 8).Take(6); ViewModels.Goodss index = new ViewModels.Goodss(); index.Good6 = good; index.Good1 = Zhanji; index.Good2 = Qiang; index.Good3 = Hangmu; index.Good4 = Feixing; index.Good5 = Tanke; return(View(index)); }
public GoodsController(GoodsManage manage) { goodsManage = manage; }
// GET: AllGoods public ActionResult Index(String classifyInfoFrom, String SortInfoFrom, string currentFilter, int?page) { var goods = GoodsManage.FindGoods(); if (classifyInfoFrom != null) { Session["fenlei"] = classifyInfoFrom; } if (classifyInfoFrom != null) { page = 1; } else { classifyInfoFrom = currentFilter; } ViewBag.CurrentFilter = classifyInfoFrom; if (SortInfoFrom != null) { page = 1; } else { SortInfoFrom = currentFilter; } ViewBag.CurrentFilter = SortInfoFrom; if (!string.IsNullOrEmpty(classifyInfoFrom)) //注意,判断字符串类型为空,要使用String.IsNullEmpty() 而不能使用 !=null 来判断。 { goods = goods.Where(x => x.Classify.ClassifyName == classifyInfoFrom); } //ViewBag.searchString = searchString; if (!String.IsNullOrEmpty(SortInfoFrom)) { if (Session["fenlei"] != null) { var clssif = Session["fenlei"].ToString(); if (SortInfoFrom == "价格降序") { goods = goods.Where(x => x.Classify.ClassifyName == clssif).OrderByDescending(p => p.GoodsPrice); } else if (SortInfoFrom == "价格升序") { goods = goods.Where(x => x.Classify.ClassifyName == clssif).OrderBy(p => p.GoodsPrice); } else if (SortInfoFrom == "更新时间") { goods = goods.Where(x => x.Classify.ClassifyName == clssif).OrderByDescending(p => p.Grounding); } } else { if (SortInfoFrom == "价格降序") { goods = goods.OrderByDescending(p => p.GoodsPrice); } else if (SortInfoFrom == "价格升序") { goods = goods.OrderBy(p => p.GoodsPrice); } else if (SortInfoFrom == "更新时间") { goods = goods.OrderByDescending(p => p.Grounding); } } } int pageSize = 9; int pageNumber = (page ?? 1); if (Request.IsAjaxRequest()) { return(PartialView("Index", goods.ToPagedList(pageNumber, pageSize))); } else { return(View("Index", goods.ToPagedList(pageNumber, pageSize))); } }