Ejemplo n.º 1
0
        public async Task <CommonResponse> AskPasswordChangeCommand(AskPasswordChangeRequest requestModel)
        {
            try
            {
                using (var httpClient = GetHttpClient())
                {
                    var stringContent = new List <KeyValuePair <string, string> >();
                    stringContent.Add(new KeyValuePair <string, string>("IMEI", requestModel.IMEI));
                    stringContent.Add(new KeyValuePair <string, string>("EMAIL", requestModel.EMAIL));

                    var content = new MultipartFormDataContent();
                    foreach (var keyValuePair in stringContent)
                    {
                        content.Add(new StringContent(keyValuePair.Value), keyValuePair.Key);
                    }
                    var response = await httpClient.PostAsync(ServerURL.AskChangePasswordURL, content);

                    if (response == null)
                    {
                        return(null);
                    }
                    if (response.StatusCode == System.Net.HttpStatusCode.OK)
                    {
                        string retVal = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

                        var responseItem = JsonConvert.DeserializeObject <CommonResponse>(retVal);
                        return(responseItem);
                    }
                }
            }
            catch (Exception exp) { }
            return(null);
        }
Ejemplo n.º 2
0
 void BtSubmit_Click(object sender, EventArgs e)
 {
     if (StringCheckUtil.isEmpty(editEmail.EditText))
     {
         return;
     }
     if (!StringCheckUtil.isEmailAddress(editEmail.EditText))
     {
         return;
     }
     if (CrossConnectivity.Current.IsConnected)
     {
         var ImeiCode     = PhoneIMEI.GetImei(ParentActivity);
         var requestModel = new AskPasswordChangeRequest()
         {
             EMAIL = editEmail.EditText.Text.Trim(), IMEI = ImeiCode
         };
         ParentActivity.ViewModel.AskChangePasswordCommand.Execute(requestModel);
     }
     else
     {
         DialogUtils.ShowOKDialog(this.ParentActivity, @"Warning", @"No Internet Connection");
     }
 }