public async Task <IActionResult> LatestPostsAsync() { using (_db) { await _db.Connection.OpenAsync(); var query = new PostQuery(_db); var result = await query.LatestPostsAsync(); return(new OkObjectResult(result)); } }
public async Task <IActionResult> GetLatest() { using (var db = new AppDb(connection_string)) { await db.Connection.OpenAsync(); var query = new PostQuery(db); var result = await query.LatestPostsAsync(); return(new OkObjectResult(result)); } }