public ActionResult FBMembers(int p = 1) { //var data = fbmembersService.GetNoDel().OrderByDescending(o => o.Createdate); var data = fbmembersService.Get().OrderByDescending(o => o.Createdate); ViewBag.pageNumber = p; ViewBag.FBMembers = data.ToPagedList(pageNumber: p, pageSize: 100); //ViewBag.FBMembers = data; //ViewBag.Check = db.FBMembers.Include(x => x.FBMembersLoginlog.OrderByDescending(o => o.Createdate).FirstOrDefault().Status == 1).Count(); ViewBag.Check = fbmembersService.Get().Include(a => a.FBMembersLoginlog).Where(a => a.FBMembersLoginlog.FirstOrDefault().Status == 1).Count(); ViewBag.Times = fbmembersService.Get().Include(a => a.FBMembersLoginlog).Where(a => a.FBMembersLoginlog.FirstOrDefault().Status == 2).Count(); /**** FB 產品選單 ***/ FBProductDropDownList(); /**** 預備人選 ****/ ViewBag.ReservedNumber = fbmembersService.GetNoDel().Where(a => a.Isenable == 2).Count(); return(View()); }
public JsonResult AjaxCheckFBMembersNumber() { Guid CategoryId = Guid.Parse("9f268158-09b1-4176-9088-a4a4af63d389"); IEnumerable <Product> ProductList = productService.Get().Where(a => a.Categoryid == CategoryId).OrderBy(o => o.Orders); List <ProductNumber> List = new List <ProductNumber>(); foreach (Product Product in ProductList) { int Count = fbmembersService.Get().Where(a => a.FBMembersLoginlog.FirstOrDefault().Status != 2).Where(p => p.Productid == Product.Productid).Count(); int PrepCount = fbmembersService.GetNoDel().Where(i => i.Isenable == 2).Where(a => a.FBMembersLoginlog.FirstOrDefault().Status != 2).Where(p => p.Productid == Product.Productid).Count(); int Death = fbmembersService.Get().Where(a => a.FBMembersLoginlog.FirstOrDefault().Status == 2).Where(p => p.Productid == Product.Productid).Count(); List.Add( new ProductNumber() { Productname = Product.Productname, Productcount = Count, Productprepcount = PrepCount, Productdeathcount = Death } ); } return(this.Json(List, JsonRequestBehavior.AllowGet)); }