diff --git a/src/Ombi.Core/Engine/BaseMediaEngine.cs b/src/Ombi.Core/Engine/BaseMediaEngine.cs index fde13a798..ce1713bb8 100644 --- a/src/Ombi.Core/Engine/BaseMediaEngine.cs +++ b/src/Ombi.Core/Engine/BaseMediaEngine.cs @@ -136,7 +136,7 @@ namespace Ombi.Core.Engine { var user = await GetUser(); var existingSub = await _subscriptionRepository.GetAll().FirstOrDefaultAsync(x => - x.UserId.Equals(user.Id) && x.RequestId == requestId && x.RequestType == type); + x.UserId == user.Id && x.RequestId == requestId && x.RequestType == type); if (existingSub != null) { return; @@ -155,7 +155,7 @@ namespace Ombi.Core.Engine { var user = await GetUser(); var existingSub = await _subscriptionRepository.GetAll().FirstOrDefaultAsync(x => - x.UserId.Equals(user.Id) && x.RequestId == requestId && x.RequestType == type); + x.UserId == user.Id && x.RequestId == requestId && x.RequestType == type); if (existingSub != null) { await _subscriptionRepository.Delete(existingSub); diff --git a/src/Ombi.Core/Rule/Rules/Request/AutoApproveRule.cs b/src/Ombi.Core/Rule/Rules/Request/AutoApproveRule.cs index 6b528e806..f427434f0 100644 --- a/src/Ombi.Core/Rule/Rules/Request/AutoApproveRule.cs +++ b/src/Ombi.Core/Rule/Rules/Request/AutoApproveRule.cs @@ -24,7 +24,8 @@ namespace Ombi.Core.Rule.Rules.Request public async Task Execute(BaseRequest obj) { - var user = await _manager.Users.FirstOrDefaultAsync(x => x.UserName.Equals(User.Identity.Name, StringComparison.InvariantCultureIgnoreCase)); + var username = User.Identity.Name.ToUpper(); + var user = await _manager.Users.FirstOrDefaultAsync(x => x.NormalizedUserName == username); if (await _manager.IsInRoleAsync(user, OmbiRoles.Admin) || user.IsSystemUser) { obj.Approved = true; diff --git a/src/Ombi.Core/Rule/Rules/Request/CanRequestRule.cs b/src/Ombi.Core/Rule/Rules/Request/CanRequestRule.cs index 213aa94c8..23ad86dc0 100644 --- a/src/Ombi.Core/Rule/Rules/Request/CanRequestRule.cs +++ b/src/Ombi.Core/Rule/Rules/Request/CanRequestRule.cs @@ -25,7 +25,8 @@ namespace Ombi.Core.Rule.Rules.Request public async Task Execute(BaseRequest obj) { - var user = await _manager.Users.FirstOrDefaultAsync(x => x.UserName.Equals(User.Identity.Name, StringComparison.InvariantCultureIgnoreCase)); + var username = User.Identity.Name.ToUpper(); + var user = await _manager.Users.FirstOrDefaultAsync(x => x.NormalizedUserName == username); if (await _manager.IsInRoleAsync(user, OmbiRoles.Admin) || user.IsSystemUser) return Success(); diff --git a/src/Ombi.Core/Rule/Rules/Request/ExistingMovieRequestRule.cs b/src/Ombi.Core/Rule/Rules/Request/ExistingMovieRequestRule.cs index bc580e9ea..15861ca27 100644 --- a/src/Ombi.Core/Rule/Rules/Request/ExistingMovieRequestRule.cs +++ b/src/Ombi.Core/Rule/Rules/Request/ExistingMovieRequestRule.cs @@ -41,7 +41,7 @@ namespace Ombi.Core.Rule.Rules.Request { // Let's check imdbid existing = await movieRequests.FirstOrDefaultAsync(x => - x.ImdbId.Equals(movie.ImdbId, StringComparison.CurrentCultureIgnoreCase)); + x.ImdbId == movie.ImdbId); if (existing != null) { found = true; diff --git a/src/Ombi.Core/Rule/Rules/Request/ExistingPlexRequestRule.cs b/src/Ombi.Core/Rule/Rules/Request/ExistingPlexRequestRule.cs index 0d887063e..3dac2ceff 100644 --- a/src/Ombi.Core/Rule/Rules/Request/ExistingPlexRequestRule.cs +++ b/src/Ombi.Core/Rule/Rules/Request/ExistingPlexRequestRule.cs @@ -32,13 +32,13 @@ namespace Ombi.Core.Rule.Rules.Request var tvContent = _plexContent.GetAll().Where(x => x.Type == PlexMediaTypeEntity.Show); // We need to do a check on the TVDBId - var anyTvDbMatches = await tvContent.Include(x => x.Episodes).FirstOrDefaultAsync(x => x.HasTvDb && x.TvDbId.Equals(tvRequest.Id.ToString(), StringComparison.InvariantCultureIgnoreCase)); // the Id on the child is the tvdbid at this point + var anyTvDbMatches = await tvContent.Include(x => x.Episodes).FirstOrDefaultAsync(x => x.HasTvDb && x.TvDbId == tvRequest.Id.ToString()); // the Id on the child is the tvdbid at this point if (anyTvDbMatches == null) { // So we do not have a TVDB Id, that really sucks. // Let's try and match on the title and year of the show var titleAndYearMatch = await tvContent.Include(x=> x.Episodes).FirstOrDefaultAsync(x => - x.Title.Equals(tvRequest.Title, StringComparison.InvariantCultureIgnoreCase) + x.Title == tvRequest.Title && x.ReleaseYear == tvRequest.ReleaseYear.Year.ToString()); if (titleAndYearMatch != null) { diff --git a/src/Ombi.Core/Rule/Rules/Search/LidarrAlbumCacheRule.cs b/src/Ombi.Core/Rule/Rules/Search/LidarrAlbumCacheRule.cs index ac01a2dfa..3ca57d635 100644 --- a/src/Ombi.Core/Rule/Rules/Search/LidarrAlbumCacheRule.cs +++ b/src/Ombi.Core/Rule/Rules/Search/LidarrAlbumCacheRule.cs @@ -24,7 +24,7 @@ namespace Ombi.Core.Rule.Rules.Search { // Check if it's in Lidarr var result = _db.GetAll().FirstOrDefault(x => - x.ForeignAlbumId.Equals(obj.ForeignAlbumId, StringComparison.InvariantCultureIgnoreCase)); + x.ForeignAlbumId == obj.ForeignAlbumId); if (result != null) { obj.PercentOfTracks = result.PercentOfTracks; @@ -36,7 +36,7 @@ namespace Ombi.Core.Rule.Rules.Search { // Check if it's in Lidarr var result = _db.GetAll().FirstOrDefault(x => - x.ForeignAlbumId.Equals(release.Id, StringComparison.InvariantCultureIgnoreCase)); + x.ForeignAlbumId == release.Id); if (result != null) { release.PercentOfTracks = result.PercentOfTracks; diff --git a/src/Ombi.Core/Rule/Rules/Search/LidarrArtistCacheRule.cs b/src/Ombi.Core/Rule/Rules/Search/LidarrArtistCacheRule.cs index d9667d66b..a254ea2d3 100644 --- a/src/Ombi.Core/Rule/Rules/Search/LidarrArtistCacheRule.cs +++ b/src/Ombi.Core/Rule/Rules/Search/LidarrArtistCacheRule.cs @@ -21,7 +21,7 @@ namespace Ombi.Core.Rule.Rules.Search { var obj = (SearchArtistViewModel) objec; // Check if it's in Lidarr - var result = _db.GetAll().FirstOrDefault(x => x.ForeignArtistId.Equals(obj.ForignArtistId, StringComparison.InvariantCultureIgnoreCase)); + var result = _db.GetAll().FirstOrDefault(x => x.ForeignArtistId == obj.ForignArtistId); if (result != null) { obj.Monitored = true; // It's in Lidarr so it's monitored diff --git a/src/Ombi.Core/Senders/MusicSender.cs b/src/Ombi.Core/Senders/MusicSender.cs index 50881cb8f..6390578dd 100644 --- a/src/Ombi.Core/Senders/MusicSender.cs +++ b/src/Ombi.Core/Senders/MusicSender.cs @@ -126,7 +126,7 @@ namespace Ombi.Core.Senders var album = await _lidarrApi.GetAllAlbumsByArtistId(result.id, settings.ApiKey, settings.FullUri); var albumToSearch = album.FirstOrDefault(x => - x.foreignAlbumId.Equals(model.ForeignAlbumId, StringComparison.InvariantCultureIgnoreCase)); + x.foreignAlbumId == model.ForeignAlbumId); var maxRetryCount = 10; // 5 seconds var currentRetry = 0; while (albumToSearch != null) @@ -139,7 +139,7 @@ namespace Ombi.Core.Senders await Task.Delay(500); album = await _lidarrApi.GetAllAlbumsByArtistId(result.id, settings.ApiKey, settings.FullUri); albumToSearch = album.FirstOrDefault(x => - x.foreignAlbumId.Equals(model.ForeignAlbumId, StringComparison.InvariantCultureIgnoreCase)); + x.foreignAlbumId == model.ForeignAlbumId); } @@ -165,7 +165,7 @@ namespace Ombi.Core.Senders // Get the album id var albums = await _lidarrApi.GetAllAlbumsByArtistId(artist.id, settings.ApiKey, settings.FullUri); var album = albums.FirstOrDefault(x => - x.foreignAlbumId.Equals(model.ForeignAlbumId, StringComparison.InvariantCultureIgnoreCase)); + x.foreignAlbumId == model.ForeignAlbumId); var maxRetryCount = 10; // 5 seconds var currentRetry = 0; while (!albums.Any() || album == null) @@ -178,7 +178,7 @@ namespace Ombi.Core.Senders await Task.Delay(500); albums = await _lidarrApi.GetAllAlbumsByArtistId(artist.id, settings.ApiKey, settings.FullUri); album = albums.FirstOrDefault(x => - x.foreignAlbumId.Equals(model.ForeignAlbumId, StringComparison.InvariantCultureIgnoreCase)); + x.foreignAlbumId == model.ForeignAlbumId); } // Get the album we want.