コード例 #1
0
        public async Task <BookVo> GetRandomBook()
        {
            var count = await _bookRead.CountAsync();

            var index = _Random.Next(0, (int)count);
            var book  = await _bookRead.PageAsync(index, 1);

            return(_mapper.Map <BookVo>(book.ElementAt(0)));
        }
コード例 #2
0
        public async Task <PersonVo> GetRandomPerson()
        {
            var count = await _personRead.CountAsync();

            var index       = _Random.Next(0, (int)count);
            var personArray = await _personRead.PageAsync(index, 1);

            return(_mapper.Map <PersonVo>(personArray.ElementAt(0)));
        }