示例#1
0
        public async Task <IActionResult> GetValuesAsync()
        {
            await _db.Connection.OpenAsync();

            var query  = new ValuesQuery(_db);
            var result = await query.LatestPostsAsync();

            return(new OkObjectResult(result));
        }
示例#2
0
        public async Task <IActionResult> GetValuesAsync(int id)
        {
            await _db.Connection.OpenAsync();

            var query  = new ValuesQuery(_db);
            var result = await query.FindOneAsync(id);

            if (result is null)
            {
                return(new NotFoundResult());
            }
            return(new OkObjectResult(result));
        }
 public async Task <IEnumerable <ValueModel> > Handle(ValuesQuery request) =>
 _mapper.Map <IEnumerable <ValueModel> >(await _valuesReadRepository.Get());