Update QuoteRepository.cs

updated with syntax from added extensions
This commit is contained in:
Shikhir Arora 2017-03-02 17:26:40 -05:00 committed by GitHub
parent 33faec9649
commit f023251170

View File

@ -1,4 +1,5 @@
using NadekoBot.Services.Database.Models; using NadekoBot.Services.Database.Models;
using NadekoBot.Extensions;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -27,7 +28,7 @@ namespace NadekoBot.Services.Database.Repositories.Impl
public Task<Quote> SearchQuoteKeywordTextAsync(ulong guildId, string keyword, string text) public Task<Quote> SearchQuoteKeywordTextAsync(ulong guildId, string keyword, string text)
{ {
var rngk = new NadekoRandom(); var rngk = new NadekoRandom();
return _set.Where(q => q.Text.IndexOf(text, StringComparison.OrdinalIgnoreCase) >=0 && q.GuildId == guildId && q.Keyword == keyword).OrderBy(q => rngk.Next()).FirstOrDefaultAsync(); return _set.Where(q => q.Text.ContainsNoCase(text, StringComparison.OrdinalIgnoreCase) && q.GuildId == guildId && q.Keyword == keyword).OrderBy(q => rngk.Next()).FirstOrDefaultAsync();
} }
} }
} }