示例#1
0
 /// <summary>
 /// Tries to delete session by session id and returns optional <see cref="Error"/>.
 /// </summary>
 /// <typeparam name="TSessionState">Session state.</typeparam>
 /// <typeparam name="TOperationState">Operation state.</typeparam>
 /// <param name="sessionManager">Source session manager.</param>
 /// <param name="sessionId">SessionId.</param>
 /// <returns>Optional error.</returns>
 public static Error <ErrorCode>?TryDeleteSession <TSessionState, TOperationState>(this ISessionManager <TSessionState, TOperationState> sessionManager, string sessionId)
 {
     return(Error.Try <ErrorCode>(() =>
     {
         sessionManager.DeleteSession(sessionId);
     }));
 }
        public HttpResponseMessage Logout(LogoutUserRequest request)
        {
            LogoutUserResponse response = new LogoutUserResponse();

            //deleting session
            _sessionManager.DeleteSession(request.SessionId);
            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
        public ActionResult LogOut(AuthViewModel viewModel)
        {
            _sessionManager.DeleteSession(viewModel.SessionId);

            var baseViewModel = new BaseViewModel();

            return(View("LoggedOut", baseViewModel));
        }