Example #1
0
        private async Task <int> NextGameChoiceAsync(AppDbContext ltctx, mMember member, dChoice choice)
        {
            var _no_choice = 0;

            try
            {
                var _counter = ltctx.tb_lion_choice
                               .Where(x => x.SequenceNo == choice.sequence_no && x.LoginId == choice.login_id)
                               .Count();

                // 할당량 만큼 choice(선택) 되었으면 더이상 추가 하지 않음
                if (member.MaxSelectNumber > _counter)
                {
                    _no_choice = _winnerMember.WinnerChoice(ltctx, member, choice, _counter);
                    _winnerScoring.PutJackpot(ltctx, member, choice.sequence_no, (short)_no_choice);

                    await ltctx.SaveChangesAsync();
                }
            }
            catch (Exception ex)
            {
                ltctx.Database.RollbackTransaction();

                _logger.LogError(ex, "receiver.choicer");
            }

            return(_no_choice);
        }