public ActionResult EditYTOrder(Guid YTOrderid) { YTOrder ytorder = ytorderService.GetByID(YTOrderid); if (TryUpdateModel(ytorder, new string[] { "Url", "Count", "Productid", "YTOrderStatus", "Categoryid", "Istest" }) && ModelState.IsValid) { /*** 訂單不是進行中,將完成名單的會員Docker關閉 ****/ if (ytorder.YTOrderStatus != 1) { IEnumerable <YTMembers> YTMembers = ytmembersService.Get(); IEnumerable <YTOrderlist> YTOrderlist = ytorderlistService.Get().Where(a => a.YTOrderid == YTOrderid); foreach (YTOrderlist list in YTOrderlist) { foreach (YTMembers YTMember in YTMembers) { if (YTMember.YTMemberid == list.YTMemberid) { YTMember.Isdocker = 0; // 關閉Docker 【0 : 關閉, 1 : 開啟】 ytmembersService.SpecificUpdate(YTMember, new string[] { "Isdocker" }); } } } ytmembersService.SaveChanges(); } ytorderService.Update(ytorder); ytorderService.SaveChanges(); } return(RedirectToAction("YTOrder")); }
public ActionResult YTMembers(int p = 1) { var data = ytmembersService.Get().OrderByDescending(o => o.Createdate); ViewBag.pageNumber = p; ViewBag.YTMembers = data.ToPagedList(pageNumber: p, pageSize: 20); ViewBag.Check = ytmembersService.Get().Where(a => a.YTMembersLoginlog.OrderByDescending(o => o.Createdate).FirstOrDefault().Status == 1).Count(); ViewBag.Times = ytmembersService.Get().Where(a => a.YTMembersLoginlog.OrderByDescending(o => o.Createdate).FirstOrDefault().Status == 2).Count(); return(View()); }