.listquotes now shows this server's quotes

This commit is contained in:
Kwoth 2016-12-15 19:20:26 +01:00
parent 1368e1e929
commit e0150e605a
3 changed files with 4 additions and 4 deletions

View File

@ -27,7 +27,7 @@ namespace NadekoBot.Modules.Utility
IEnumerable<Quote> quotes; IEnumerable<Quote> quotes;
using (var uow = DbHandler.UnitOfWork()) using (var uow = DbHandler.UnitOfWork())
{ {
quotes = uow.Quotes.GetGroup(page * 16, 16); quotes = uow.Quotes.GetGroup(channel.Guild.Id, page * 16, 16);
} }
if (quotes.Any()) if (quotes.Any())

View File

@ -8,6 +8,6 @@ namespace NadekoBot.Services.Database.Repositories
{ {
IEnumerable<Quote> GetAllQuotesByKeyword(ulong guildId, string keyword); IEnumerable<Quote> GetAllQuotesByKeyword(ulong guildId, string keyword);
Task<Quote> GetRandomQuoteByKeywordAsync(ulong guildId, string keyword); Task<Quote> GetRandomQuoteByKeywordAsync(ulong guildId, string keyword);
IEnumerable<Quote> GetGroup(int skip, int take); IEnumerable<Quote> GetGroup(ulong guildId, int skip, int take);
} }
} }

View File

@ -15,8 +15,8 @@ namespace NadekoBot.Services.Database.Repositories.Impl
public IEnumerable<Quote> GetAllQuotesByKeyword(ulong guildId, string keyword) => public IEnumerable<Quote> GetAllQuotesByKeyword(ulong guildId, string keyword) =>
_set.Where(q => q.GuildId == guildId && q.Keyword == keyword); _set.Where(q => q.GuildId == guildId && q.Keyword == keyword);
public IEnumerable<Quote> GetGroup(int skip, int take) => public IEnumerable<Quote> GetGroup(ulong guildId, int skip, int take) =>
_set.OrderBy(q => q.Keyword).Skip(skip).Take(take).ToList(); _set.Where(q=>q.GuildId == guildId).OrderBy(q => q.Keyword).Skip(skip).Take(take).ToList();
public Task<Quote> GetRandomQuoteByKeywordAsync(ulong guildId, string keyword) public Task<Quote> GetRandomQuoteByKeywordAsync(ulong guildId, string keyword)
{ {