예제 #1
0
        public PartialViewResult DrawResult(int num)
        {
            var drawList = (from mp in _db.Member_Prize
                            join m in _db.Members on mp.MemberID equals m.Id into Members
                            from members in Members.DefaultIfEmpty()
                            join p in _db.Prizes on mp.PrizeID equals p.Id into Prizes
                            from prize in Prizes.DefaultIfEmpty()
                            orderby mp.AddTime descending
                            select new DrawResultModel()
            {
                Member = members,
                Prize = prize
            }).Where(x => x.Member != null && x.Prize != null).Take(14);

            return(PartialView(drawList.ToArray()));
        }
예제 #2
0
        protected IQueryable <DrawResultModel> Filter(RewardFilter filter, LuckyDrawEntities _db)
        {
            var fResult = (from mp in _db.Member_Prize
                           join member in _db.Members on mp.MemberID equals member.Id into Members
                           from m in Members.DefaultIfEmpty()
                           join prize in _db.Prizes on mp.PrizeID equals prize.Id into Prizes
                           from p in Prizes.DefaultIfEmpty()
                           where mp.HasReceived &&
                           (!string.IsNullOrEmpty(filter.MemberMobile) ? m.Mobile.Contains(filter.MemberMobile) : true) &&
                           (!string.IsNullOrEmpty(filter.MemberName) ? m.Name.Contains(filter.MemberName) : true) &&
                           (!string.IsNullOrEmpty(filter.PrizeName) ? p.Name.Contains(filter.PrizeName) : true)
                           select new DrawResultModel()
            {
                Member = m,
                Prize = p,
                Id = mp.Id,
                AddTime = mp.AddTime
            });

            return(fResult);
        }