public async Task <IActionResult> GetSession(string id) { try { var session = await _sessionsRepository.GetSession(Guid.Parse(id)); return(Ok(session)); } catch (Exception ex) { return(HandleError(ex)); } }
private object Execute(IEventPublisher eventPublisher, ISessionsRepository sessionsRepository, LogOutUser command) { var session = sessionsRepository.GetSession(command.SessionId); session.Logout(eventPublisher); return(Negotiate.WithStatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetLockedLicenses() { try { var token = GetHeaderSessionToken(); var session = await _sessions.GetSession(Session.Convert(token)); if (session == null) { return(Unauthorized()); } var licenses = await _repo.GetLockedLicenses(session.UserId, session.LicenseLevel, WebApiConfig.LicenseHoldTime); var response = Request.CreateResponse(HttpStatusCode.OK, new LicenseInfo { LicenseLevel = session.LicenseLevel, Count = licenses }); return(ResponseMessage(response)); } catch (ArgumentNullException) { return(Unauthorized()); } catch (FormatException) { return(Unauthorized()); } catch (Exception ex) { await _log.LogError(WebApiConfig.LogSourceLicenses, ex); return(InternalServerError()); } }