From 20d35a640570eab1a47e4bd8c156f1e8aeb7db2d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 1 Jun 2014 00:11:04 -0400 Subject: isolate .net specific methods in model project --- MediaBrowser.Server.Implementations/Session/SessionManager.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Session') diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 5181361e3..ec3e636ae 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -256,7 +256,7 @@ namespace MediaBrowser.Server.Implementations.Session try { - var session = GetSession(sessionId); + var session = GetSession(sessionId, false); if (session != null) { @@ -710,13 +710,14 @@ namespace MediaBrowser.Server.Implementations.Session /// Gets the session. /// /// The session identifier. + /// if set to true [throw on missing]. /// SessionInfo. /// - private SessionInfo GetSession(string sessionId) + private SessionInfo GetSession(string sessionId, bool throwOnMissing = true) { - var session = Sessions.First(i => string.Equals(i.Id, sessionId)); + var session = Sessions.FirstOrDefault(i => string.Equals(i.Id, sessionId)); - if (session == null) + if (session == null && throwOnMissing) { throw new ResourceNotFoundException(string.Format("Session {0} not found.", sessionId)); } -- cgit v1.2.3