public async Task <IEnumerable <ObterUltimosCincoPostsResult> > Obter() { var obterUltimosCincoPostsQuery = new ObterUltimosCincoPostsQuery(_dapperConnectionFactory); var obterUltimosCincoPostsParameter = new ObterUltimosCincoPostsParameter(); return(await obterUltimosCincoPostsQuery.HandleAsync(obterUltimosCincoPostsParameter)); }
public override async Task <IEnumerable <ObterUltimosCincoPostsResult> > HandleAsync(ObterUltimosCincoPostsParameter parameter) { const string query = @" SELECT Titulo, Descricao, Conteudo, QuantidadeLikes, QuantidadeViews, DataCriacao FROM POST ORDER BY datetime(DataCriacao) DESC, QuantidadeLikes DESC Limit 5"; using (var connection = ConnectionFactory.CreateConnection()) { return(await connection.QueryAsync <ObterUltimosCincoPostsResult>(query)); } }