diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-06-01 00:11:04 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-06-01 00:11:04 -0400 |
| commit | 20d35a640570eab1a47e4bd8c156f1e8aeb7db2d (patch) | |
| tree | 4464240863af1e8e6fa811583bb82ad8864dd3ab /MediaBrowser.Server.Implementations/Session/SessionManager.cs | |
| parent | d1e045f66274e8ec240557d32f484d8640b05edc (diff) | |
isolate .net specific methods in model project
Diffstat (limited to 'MediaBrowser.Server.Implementations/Session/SessionManager.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Session/SessionManager.cs | 9 |
1 files changed, 5 insertions, 4 deletions
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. /// </summary> /// <param name="sessionId">The session identifier.</param> + /// <param name="throwOnMissing">if set to <c>true</c> [throw on missing].</param> /// <returns>SessionInfo.</returns> /// <exception cref="ResourceNotFoundException"></exception> - 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)); } |
