Ejemplo n.º 1
0
 public EditProfilePage()
 {
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     //_objGenderViewModel = new GenderViewModel();
     //  RadioGenderCheck.ItemsSource = _objGenderViewModel.GetRadioType();
     _objRegisterUserResponse  = new RegisterUserResponse();
     _objRegisterUserRequest   = new RegisterUserRequest();
     _objEditUserResquestModel = new EditUserResquestModel();
     _objEditUserResponseModel = new EditUserResponseModel();
     _objHeaderModel           = new HeaderModel();
     _objHeaderModel.OTPToken  = Settings.TokenCode;
     _baseUrl       = Settings.Url + Domain.EditUserApiConstant;
     _apiServices   = new RestApi();
     _baseUrlUpdate = Settings.Url + Domain.UpdateUserApiConstant;
     LoaduserDetails();
     //  BindingContext = _objEditUserResponseModel.Response;
 }
Ejemplo n.º 2
0
        public async Task <EditUserResponseModel> EditUserAsync(string uri, Boolean IsHeaderRequired, HeaderModel objHeaderModel, EditUserResquestModel _objEditUserResquestModel)
        {
            EditUserResponseModel objEditUserResponseModel;
            string s = JsonConvert.SerializeObject(_objEditUserResquestModel);
            HttpResponseMessage response = null;

            using (var stringContent = new StringContent(s, System.Text.Encoding.UTF8, "application/json"))
            {
                if (IsHeaderRequired)
                {
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", objHeaderModel.OTPToken);
                }
                response = await client.PostAsync(uri, stringContent);


                if (response.IsSuccessStatusCode)
                {
                    var SucessResponse = await response.Content.ReadAsStringAsync();

                    objEditUserResponseModel = JsonConvert.DeserializeObject <EditUserResponseModel>(SucessResponse);
                    return(objEditUserResponseModel);
                }
                else
                {
                    var ErrorResponse = await response.Content.ReadAsStringAsync();

                    objEditUserResponseModel = JsonConvert.DeserializeObject <EditUserResponseModel>(ErrorResponse);
                    return(objEditUserResponseModel);
                }
            }
        }