示例#1
0
 public IRestResponse<ApiTicket> Login(User user)
 {
     var restClient = new RestClient (_baseUrl);
     var request = new RestRequest("access/ticket", Method.POST) {RequestFormat = DataFormat.Json};
     request.AddParameter ("username", user.Username);
     request.AddParameter ("password", user.Password);
     request.AddParameter ("realm", user.Realm);
     request.RootElement = RequestRootElement;
     var response = restClient.Execute<ApiTicket>(request);
     _apiTicket = response.Data;
     return response;
 }
示例#2
0
        public IRestResponse <ApiTicket> Login(User user)
        {
            var restClient = new RestClient(_baseUrl);
            var request    = new RestRequest("access/ticket", Method.POST)
            {
                RequestFormat = DataFormat.Json
            };

            request.AddParameter("username", user.Username);
            request.AddParameter("password", user.Password);
            request.AddParameter("realm", user.Realm);
            request.RootElement = RequestRootElement;
            var response = restClient.Execute <ApiTicket>(request);

            _apiTicket = response.Data;
            return(response);
        }