コード例 #1
0
        public async Task <SpinRemainDto> CheckSpinRemain(int prizeID)
        {
            var prize = await _prizeRepository.FindSingle(x => x.PrizeID == prizeID);

            var recordCount = await _recordRepository.FindAll(x => x.PrizeID == prizeID).CountAsync();

            if (prize != null)
            {
                return new SpinRemainDto
                       {
                           Current = recordCount,
                           Total   = prize.Qty.Value,
                           IsValid = recordCount < prize.Qty.Value ? true : false
                       }
            }
            ;
            else
            {
                return(new SpinRemainDto());
            }
        }
コード例 #2
0
        public IEnumerable <RecordModel> FindAll()
        {
            var recordEntities = _recordRepository.FindAll();

            return(recordEntities.Select(RecordMapper.ToModel));
        }