public ActionResult DoSign() { DealViewBag("DoSign"); IEnumerable <SignList> signLists = EFSign.signLists.OrderByDescending(s => s.SignID).Take(3); List <SignInfo> signInfos = new List <SignInfo>(); List <MemberGroup> memberGroups = new List <MemberGroup>(); foreach (var item in signLists) { SignInfo signInfo = EFSign.signInfos.Where(s => s.SignID == item.SignID && s.GameID == GameID).FirstOrDefault(); if (signInfo != null) { signInfos.Add(signInfo); MemberGroup memberGroup = EFMemberGroup.MemberGroups.Where(m => m.MemberGroupID == item.MemberGroupID && m.GameID == GameID).FirstOrDefault(); if (memberGroup != null) { memberGroups.Add(memberGroup); } } } DoSignViewModel doSignViewModel = new DoSignViewModel { signInfos = signInfos, signLists = signLists, MemberGroups = memberGroups, }; return(View(doSignViewModel)); }
public ActionResult UpdateSign(string SignID, string SignCondition, bool IsLeave) { SignInfo signInfoResult = EFSign.signInfos.Where(s => s.SignID == SignID && s.GameID == GameID).FirstOrDefault(); if (signInfoResult != null) { if (IsLeave) { signInfoResult.IsLeave = true; signInfoResult.SignDatetime = DateTime.Now; } else { signInfoResult.IsLeave = false; signInfoResult.SignDatetime = DateTime.Now; signInfoResult.SignCondition = SignCondition; } if (EFSign.UpdateSignInfo(signInfoResult)) { IEnumerable <SignList> signLists = EFSign.signLists.OrderByDescending(s => s.SignID).Take(3); List <SignInfo> signInfos = new List <SignInfo>(); List <MemberGroup> memberGroups = new List <MemberGroup>(); foreach (var item in signLists) { SignInfo signInfo = EFSign.signInfos.Where(s => s.SignID == item.SignID && s.GameID == GameID).FirstOrDefault(); if (signInfo != null) { signInfos.Add(signInfo); MemberGroup memberGroup = EFMemberGroup.MemberGroups.Where(m => m.MemberGroupID == item.MemberGroupID && m.GameID == GameID).FirstOrDefault(); if (memberGroup != null) { memberGroups.Add(memberGroup); } } } DoSignViewModel doSignViewModel = new DoSignViewModel { signInfos = signInfos, signLists = signLists, MemberGroups = memberGroups, }; return(PartialView("_DoSign", doSignViewModel)); } } return(View(false)); }