private async void uploadMedia(string filePath, string mediaType, UserRegisterResponseViewModel model) { var mediaName = System.IO.Path.GetFileName(filePath); //AWSUploader.SetMediaName (mediaType); var url = ""; try { // BTProgressHUD.Show("Processing media..", maskType: ProgressHUD.MaskType.Black); if (mediaType == "Photo") { await AWSUploader.AWSUploadImage(filePath, mediaName); } else { await AWSUploader.AWSUploadAudioVideo(filePath, mediaName, mediaType); } url = AWSUploader.GetMediaUrl(mediaType) + mediaName; try { if (string.IsNullOrEmpty(url)) { //Toast.MakeText(this, "Check Your Internet Connection", ToastLength.Long).Show(); } else { var Result = await new AccountService().Registration(new UserRegisterRequestViewModel { Email = model.Email, Password = model.Password, ZipCode = model.ZipCode, City = model.City, State = model.State, Country = model.Country, AboutMe = model.AboutMe, ProfileImageUrl = url, }, GlobalConstant.AccountUrls.RegisterServiceUrl); if (Result.Status == 1) { var modelReporeg = JsonConvert.DeserializeObject <UserRegisterResponseViewModel>(Result.Response.ToString()); var UserprofileRepo = UserProfileRepository.GetUserProfile(CommonHelper.GetUserId()); UserprofileRepo.ZipCode = modelReporeg.ZipCode; UserprofileRepo.City = modelReporeg.City; UserprofileRepo.State = modelReporeg.State; UserprofileRepo.Country = modelReporeg.Country; UserprofileRepo.AboutMe = modelReporeg.AboutMe; UserprofileRepo.ProfileImageUrl = modelReporeg.ProfileImageUrl; UserProfileRepository.UpdateUserProfile(UserprofileRepo); new UIAlertView("Complate Your Profile", "Profile Complete Successfully", null, "OK", null).Show(); BTProgressHUD.Dismiss(); clearAll(); //this.DismissViewController(true, null); InvokeOnMainThread(delegate { UIStoryboard storyboard = this.Storyboard; SelectInterestsTableViewController viewController = (SelectInterestsTableViewController) storyboard.InstantiateViewController("SelectInterestsTableViewController"); this.NavigationController.PushViewController(viewController, true); }); } } } catch (Exception e) { Crashes.TrackError(e); BTProgressHUD.Dismiss(); new UIAlertView("Error", e.ToString(), null, "OK", null).Show(); //Toast.MakeText(this, e.Message, ToastLength.Long).Show(); } } catch (Exception e) { Crashes.TrackError(e); BTProgressHUD.Dismiss(); new UIAlertView("Error", e.ToString(), null, "OK", null).Show(); //Toast.MakeText(this, e.Message, ToastLength.Long).Show(); } }
public async Task PleaseComplateYourProfileInfoInsertAsync() { InpowerResult Result = null; try { if (txtZipCode.Text != "") { if (txtCity.Text != "") { if (txtState.Text != "") { if (txtCountry.Text != "") { if (txtAboutMe.Text != "") { if (CrossConnectivity.Current.IsConnected) { BTProgressHUD.Show("Please Wait", maskType: ProgressHUD.MaskType.Black); var UserprofileRepo = UserProfileRepository.GetUserProfile(CommonHelper.GetUserId()); Result = await new AccountService().Registration(new UserRegisterRequestViewModel { Email = UserprofileRepo.Email, Password = UserprofileRepo.Password, ZipCode = Convert.ToInt32(txtZipCode.Text), City = txtCity.Text, State = txtState.Text, Country = txtCountry.Text, AboutMe = txtAboutMe.Text, ProfileImageUrl = ProfileImageURL, }, GlobalConstant.AccountUrls.RegisterServiceUrl); if (Result.Status == 1) { var modelReporeg = JsonConvert.DeserializeObject <UserRegisterResponseViewModel>(Result.Response.ToString()); UserprofileRepo.ZipCode = modelReporeg.ZipCode; UserprofileRepo.City = modelReporeg.City; UserprofileRepo.State = modelReporeg.State; UserprofileRepo.Country = modelReporeg.Country; UserprofileRepo.AboutMe = modelReporeg.AboutMe; UserprofileRepo.ProfileImageUrl = modelReporeg.ProfileImageUrl; if (!string.IsNullOrEmpty(filePath)) { uploadMedia(filePath, mediaType, modelReporeg); } else { UserProfileRepository.UpdateUserProfile(UserprofileRepo); new UIAlertView("Complate Your Profile", "Profile Complete Successfully", null, "OK", null).Show(); BTProgressHUD.Dismiss(); clearAll(); //this.DismissViewController(true, null); InvokeOnMainThread(delegate { UIStoryboard storyboard = this.Storyboard; SelectInterestsTableViewController viewController = (SelectInterestsTableViewController) storyboard.InstantiateViewController("SelectInterestsTableViewController"); this.NavigationController.PushViewController(viewController, true); }); } } else { BTProgressHUD.Dismiss(); new UIAlertView("Complate Your Profile", Result.Message, null, "OK", null).Show(); return; } } else { new UIAlertView("Complate Your Profile", "You're not connected to a Network", null, "OK", null).Show(); return; } } else { txtAboutMe.BecomeFirstResponder(); new UIAlertView("Complate Your Profile", "Please Enter About Me First", null, "OK", null).Show(); } } else { txtCountry.BecomeFirstResponder(); new UIAlertView("Complate Your Profile", "Please Enter Country First", null, "OK", null).Show(); } } else { txtState.BecomeFirstResponder(); new UIAlertView("Complate Your Profile", "Please Enter State First", null, "OK", null).Show(); } } else { txtCity.BecomeFirstResponder(); new UIAlertView("Complate Your Profile", "Please Enter City First", null, "OK", null).Show(); } } else { txtZipCode.BecomeFirstResponder(); new UIAlertView("Complate Your Profile", "Please Enter Zip Code First", null, "OK", null).Show(); } } catch (Exception ex) { BTProgressHUD.Dismiss(); Crashes.TrackError(ex); string ErrorMsg = ex.ToString(); new UIAlertView("Error", ErrorMsg, null, "OK", null).Show(); } }