public ActionResult Feedbackrecord() { Guid Memberid = Guid.Parse(Session["Memberid"].ToString()); ViewBag.Feedbackrecord = feedbackrecordService.Get().Where(a => a.Memberid == Memberid).OrderByDescending(o => o.Createdate); ViewBag.Membermoney = membersService.GetByID(Session["Memberid"]).Feedbackmoney; return(View()); }
public ActionResult Feedbackrecord(string Account = "", int p = 1) { /*** 下拉選單有填值 ****/ if (Account != "") { IEnumerable <Feedbackrecord> data = feedbackrecordService.Get().Where(w => w.Members.Account.Contains(Account)).OrderByDescending(o => o.Createdate); IList <RecordTotal> total = db.Feedbackrecord.GroupBy(c => c.Memberid) .Select(c => new RecordTotal { Memberid = c.Key, Total = c.Sum(s => s.Money) }).ToList(); ViewBag.total = total; ViewBag.count = total.Count; ViewBag.pageNumber = p; ViewBag.Feedbackrecord = data.ToPagedList(pageNumber: p, pageSize: 20); //MembersDropDownList(); } /**** 下拉選單沒填值 *****/ else { IEnumerable <Feedbackrecord> data = feedbackrecordService.Get().OrderByDescending(o => o.Createdate); IList <RecordTotal> total = db.Feedbackrecord.GroupBy(c => c.Memberid) .Select(c => new RecordTotal { Memberid = c.Key, Total = c.Sum(s => s.Money) }).ToList(); ViewBag.total = total; ViewBag.count = total.Count; ViewBag.pageNumber = p; ViewBag.Feedbackrecord = data.ToPagedList(pageNumber: p, pageSize: 20); //MembersDropDownList(); } return(View()); }