Exemplo n.º 1
0
        public virtual void Logout(User user, ISellTicketsClient client)
        {
            UserDTO udto = DTOUtils.GetDTO(user);

            SendRequest(new LogoutRequest(udto));
            IResponse response = ReadResponse();

            CloseConnection();
            if (response is ErrorResponse)
            {
                ErrorResponse err = (ErrorResponse)response;
                throw new ControllerException(err.Message);
            }
        }
Exemplo n.º 2
0
        public virtual void Login(User user, ISellTicketsClient client)
        {
            InitializeConnection();
            var udto = DTOUtils.GetDTO(user);

            SendRequest(new LoginRequest(udto));
            var response = ReadResponse();

            if (response is OkResponse)
            {
                this._client = client;
                return;
            }
            else if (response is ErrorResponse)
            {
                var err = (ErrorResponse)response;
                CloseConnection();
                throw new ControllerException(err.Message);
            }
        }