示例#1
0
        private void AddSession(LoginUserRequest request, LoginUserResponse response)
        {
            var user = _usersRepository.ReturnIfExsists(request.Email, request.Password);

            var sessionId = CreateSessionId();

            var expires = DateTime.Now.AddMinutes(20);


            var session = new Models.UserSession()
            {
                Expires = expires,
                UserId  = user.Id, //TODO fix
                Ticket  = sessionId
            };

            response.ExpireDate = expires;

            _userSessionRepository.AddSession(session);
            response.Ticket = sessionId;
        }