public ActionResult BrowseGoodsAll() { GoodsGroupViewModel ggvm = new GoodsGroupViewModel(); ggvm.Goods = new List <GoodsViewModel>(); ggvm.GoodsClass = new List <GoodsClassViewModel>(); foreach (Goods Gdb in (db.Goods.Where(o => o.GdsCount != 0).OrderByDescending(o => o.GdsID).ToList())) { GoodsViewModel gvm = new GoodsViewModel() { CaseID = Gdb.CaseID, GdsName = Gdb.GdsName, MemberID = Gdb.Cases.MemberID, GdsCount = Gdb.GdsCount, NickName = Gdb.Cases.Member.NickName, StatusName = db.CaseStatus.Find(db.Cases.Find(Gdb.CaseID).StatusID).StatusName, CaseTitle = Gdb.Cases.CaseTitle, GdsClass = Gdb.GdsSubClass.GoodsClass.GdsClass }; ggvm.Goods.Add(gvm); } IQueryable <string> gc = db.GoodsClass.Select(x => x.GdsClass).Distinct(); foreach (string GCdb in gc) { GoodsClassViewModel gcvm = new GoodsClassViewModel(); gcvm.GdsClass = GCdb; ggvm.GoodsClass.Add(gcvm); } return(View(ggvm)); }
public ActionResult Goodsneed() { GoodsGroupViewModel ggvm = new GoodsGroupViewModel(); ggvm.Goods = new List <GoodsViewModel>(); ggvm.GoodsClass = new List <GoodsClassViewModel>(); var q = (from o in db.Cases join g in db.Goods on o.CaseID equals g.CaseID where o.StatusID == 5 orderby g.GdsID descending select g).ToList(); foreach (Goods Gdb in (q)) { GoodsViewModel gvm = new GoodsViewModel() { CaseID = Gdb.CaseID, GdsName = Gdb.GdsName, MemberID = Gdb.Cases.MemberID, GdsCount = Gdb.GdsCount, NickName = Gdb.Cases.Member.NickName, StatusName = db.CaseStatus.Find(db.Cases.Find(Gdb.CaseID).StatusID).StatusName, CaseTitle = Gdb.Cases.CaseTitle, GdsClass = Gdb.GdsSubClass.GoodsClass.GdsClass }; ggvm.Goods.Add(gvm); } IQueryable <string> gc = db.GoodsClass.Select(x => x.GdsClass).Distinct(); foreach (string GCdb in gc) { GoodsClassViewModel gcvm = new GoodsClassViewModel(); gcvm.GdsClass = GCdb; ggvm.GoodsClass.Add(gcvm); } return(View(ggvm)); }
private void GoodsGroupButton_OnClick(object sender, RoutedEventArgs e) { DataContext = new GoodsGroupViewModel(); }