1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 22:45:44 +00:00

Comparers

This commit is contained in:
Yan Maniez 2019-06-13 23:26:00 +02:00
parent 7f2392669c
commit e1bf110ec8

View file

@ -361,18 +361,12 @@ namespace AideDeJeu.ViewModels.Library
using (var context = await StoreViewModel.GetLibraryContextAsync()) using (var context = await StoreViewModel.GetLibraryContextAsync())
{ {
return context.Monsters.Where(monster => return context.Monsters.Where(monster =>
monster != null && MatchEquals(monster.Family, this.Family) &&
monster.Family == this.Family && MatchContains(monster.Type, type) &&
monster.Type.Contains(type) && MatchEquals(monster.Size, size) &&
(string.IsNullOrEmpty(size) || (monster.Size != null && monster.Size.Equals(size))) && MatchContains(monster.Terrain, terrain) &&
(string.IsNullOrEmpty(source) || (monster.Source != null && monster.Source.Contains(source))) && MatchRange(monster.Challenge, minChallenge, maxChallenge, challengeComparer) &&
(string.IsNullOrEmpty(terrain) || (monster.Terrain != null && monster.Terrain.Contains(terrain))) && MatchSearch(monster)
challengeComparer.Compare(monster.Challenge, minChallenge) >= 0 &&
challengeComparer.Compare(monster.Challenge, maxChallenge) <= 0 &&
(
(Helpers.RemoveDiacritics(monster.Name).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower())) ||
(Helpers.RemoveDiacritics(monster.AltNameText ?? string.Empty).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower()))
)
).OrderBy(monster => Helpers.RemoveDiacritics(monster.Name)).ToList(); ).OrderBy(monster => Helpers.RemoveDiacritics(monster.Name)).ToList();
} }
} }