Update MongoPostRepository.cs

pull/2953/head
Yunus Emre Kalkan 6 years ago committed by GitHub
parent 524760b6de
commit 2e395f7166
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -35,12 +35,14 @@ namespace Volo.Blogging.Posts
public async Task<List<Post>> GetOrderedList(Guid blogId, bool @descending = false)
{
var query = GetMongoQueryable().Where(x => x.BlogId == blogId);
if (!descending)
{
return await GetMongoQueryable().Where(x => x.BlogId == blogId).OrderByDescending(x => x.CreationTime).ToListAsync();
return await query.OrderBy(x => x.CreationTime).ToListAsync();
}
return await GetMongoQueryable().Where(x => x.BlogId == blogId).OrderBy(x => x.CreationTime).ToListAsync();
return await query.OrderByDescending(x => x.CreationTime).ToListAsync();
}
}
}

Loading…
Cancel
Save