Example #1
0
        public PersonalInfoResponseModel GetAllUsers(string token)
        {
            var client  = new RestClient(ApiUrl);
            var request = new RestRequest("GetAllUsers", Method.POST);

            request.AddHeader("Authorization", "Bearer " + token);
            IRestResponse             response = client.Execute(request);
            JavaScriptSerializer      js       = new JavaScriptSerializer();
            PersonalInfoResponseModel piModel  = new PersonalInfoResponseModel();

            if (!string.IsNullOrWhiteSpace(response.Content))
            {
                piModel = js.Deserialize <PersonalInfoResponseModel>(response.Content);
            }
            return(piModel);
        }
Example #2
0
        public PersonalInfoResponseModel GetUserByInfo(string token, UserModel model)
        {
            var client  = new RestClient(ApiUrl);
            var request = new RestRequest("GetUserByInfo", Method.POST);

            request.AddHeader("Authorization", "Bearer " + token);
            request.AddParameter("Mobile", model.Mobile);
            request.AddParameter("Name", model.Name);
            request.AddParameter("Family", model.Family);
            IRestResponse             response = client.Execute(request);
            JavaScriptSerializer      js       = new JavaScriptSerializer();
            PersonalInfoResponseModel piModel  = new PersonalInfoResponseModel();

            if (!string.IsNullOrWhiteSpace(response.Content))
            {
                piModel = js.Deserialize <PersonalInfoResponseModel>(response.Content);
            }
            return(piModel);
        }