Update QuoteRepository.cs

This commit is contained in:
Shikhir Arora 2017-03-02 11:22:07 -05:00 committed by GitHub
parent 1418297958
commit f4870c4678

View File

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