diff --git a/src/NzbDrone.Common/Disk/DiskProviderBase.cs b/src/NzbDrone.Common/Disk/DiskProviderBase.cs index 9aa5ebdec..169f1a67d 100644 --- a/src/NzbDrone.Common/Disk/DiskProviderBase.cs +++ b/src/NzbDrone.Common/Disk/DiskProviderBase.cs @@ -478,8 +478,7 @@ namespace NzbDrone.Common.Disk return mounts.Where(drive => drive.RootDirectory.PathEquals(path) || drive.RootDirectory.IsParentPath(path)) - .OrderByDescending(drive => drive.RootDirectory.Length) - .FirstOrDefault(); + .MaxBy(drive => drive.RootDirectory.Length); } catch (Exception ex) { diff --git a/src/NzbDrone.Core/History/HistoryRepository.cs b/src/NzbDrone.Core/History/HistoryRepository.cs index b1435c190..c19a6870f 100644 --- a/src/NzbDrone.Core/History/HistoryRepository.cs +++ b/src/NzbDrone.Core/History/HistoryRepository.cs @@ -31,9 +31,7 @@ namespace NzbDrone.Core.History public History MostRecentForDownloadId(string downloadId) { - return FindByDownloadId(downloadId) - .OrderByDescending(h => h.Date) - .FirstOrDefault(); + return FindByDownloadId(downloadId).MaxBy(h => h.Date); } public List FindByDownloadId(string downloadId) @@ -75,9 +73,7 @@ namespace NzbDrone.Core.History public History MostRecentForIndexer(int indexerId) { - return Query(x => x.IndexerId == indexerId) - .OrderByDescending(h => h.Date) - .FirstOrDefault(); + return Query(x => x.IndexerId == indexerId).MaxBy(h => h.Date); } public List Between(DateTime start, DateTime end)