Add blog navigation
This commit is contained in:
parent
3d00f28657
commit
9fd9beb860
5 changed files with 42 additions and 12 deletions
|
@ -22,7 +22,7 @@ namespace Website.Data
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<BlogPost>> GetLatestPostsAsync(int limit, int offset) {
|
||||
public async Task<IEnumerable<BlogPost>> GetLatestPostsAsync(int limit, int offset = 0) {
|
||||
const string query = "SELECT * FROM blog_posts WHERE post_content<>'' AND post_deleted=0 ORDER BY post_timestamp DESC LIMIT @offset,@limit";
|
||||
using (var connection = _dbProvider.NewConnection()) {
|
||||
connection.Open();
|
||||
|
@ -31,7 +31,7 @@ namespace Website.Data
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<BlogPost> GetLatestPostAsync() => (await GetLatestPostsAsync(1, 0)).First();
|
||||
public async Task<BlogPost> GetLatestPostAsync() => (await GetLatestPostsAsync(1)).First();
|
||||
|
||||
public async Task<int> GetCountAsync()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue