public LoginVerificationScreen()
 {
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     codeVerificationRequest  = new CodeVerificationRequestModel();
     codeVerificationResponse = new CodeVerificationResponseModel();
     _apiServices             = new RestApi();
     _baseUrl         = Domain.Url + Domain.CodeValidateApiConstant;
     BindingContext   = codeVerificationRequest;
     XFLabelTxt1.Text = "Enter the 4 digit code sent to you at " + Settings.PhoneNo;
 }
Example #2
0
        /// <summary>
        /// Resend Code Api
        /// </summary>
        public async Task <CodeVerificationResponseModel> ResendCodeAsync(string uri, Boolean IsHeaderRequired, HeaderModel objHeaderModel, CodeVerificationRequestModel _objCodeVerificationRequestModel)
        {
            CodeVerificationResponseModel objCodeVerificationResponseModel;
            string s = JsonConvert.SerializeObject(_objCodeVerificationRequestModel);
            HttpResponseMessage response = null;

            using (var stringContent = new StringContent(s, System.Text.Encoding.UTF8, "application/json"))
            {
                IsHeaderRequired = true;
                if (IsHeaderRequired)
                {
                    //client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", objHeaderModel.TokenCode);
                    client.DefaultRequestHeaders.Authorization =
                        new AuthenticationHeaderValue(
                            "Basic",
                            Convert.ToBase64String(
                                System.Text.ASCIIEncoding.ASCII.GetBytes(
                                    string.Format("{0}:{1}", "jigadmin", "Gr8ApI#"))));
                }
                response = await client.PutAsync(uri, stringContent);


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

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

                    objCodeVerificationResponseModel = JsonConvert.DeserializeObject <CodeVerificationResponseModel>(ErrorResponse);
                    return(objCodeVerificationResponseModel);
                }
            }
        }