Example #1
0
        /// <summary>
        /// 获取可获得的奖励
        /// </summary>
        /// <param name="goalsString">进球记录</param>
        /// <param name="maxCombGoals">最大连续进球数</param>
        /// <returns></returns>
        private List <PrizeEntity> GetPrize(string goalsString, int maxCombGoals)
        {
            var resultList = new List <PrizeEntity>();
            int goals      = GetGoalsNumber(goalsString);
            //进球奖励
            var prizeList = CacheFactory.AdCache.GetPrize(1, goals);
            //连续进球奖励
            var combPrize = CacheFactory.AdCache.GetPrize(2, maxCombGoals);

            foreach (var item in prizeList)
            {
                var entity = new PrizeEntity();
                entity.ItemCode  = item.ItemCode;
                entity.ItemCount = item.ItemCount;
                entity.ItemType  = item.ItemType;
                resultList.Add(entity);
            }
            foreach (var item in combPrize)
            {
                var entity = new PrizeEntity();
                entity.ItemCode  = item.ItemCode;
                entity.ItemCount = item.ItemCount;
                entity.ItemType  = item.ItemType;
                resultList.Add(entity);
            }
            return(resultList);
        }
 public IEnumerable <ResultEntity> GetResultsByPrize(PrizeEntity prize)
 {
     return(this.DbSet
            .AsNoTracking()
            .Include(s => s.PrizeEntity)
            .Where(r => r.PrizeEntityId == prize.Id)
            .AsEnumerable());
 }