public SubmitPasswordViewModel(IUserRegistrationTrModel registrationTrModel, IApiHelper apiHelper)
 {
     this._registrationTrModel = registrationTrModel;
     this._apiHelper           = apiHelper;
     Passport          = _registrationTrModel.Passport;
     SubjectOfInterest = _registrationTrModel.SubjectOfInterest;
 }
Example #2
0
        public async Task <HttpStatusCode> RegisterUser(IUserRegistrationTrModel registrationTrModel, SecureString securePassword, SecureString confirmPassword)
        {
            InitializeClientWithAuth(apiClient, "application/json", null);
            if (SecureStringToString(securePassword) == SecureStringToString(confirmPassword))
            {
                var data = new FormUrlEncodedContent(new[]
                {
                    new KeyValuePair <string, string>("username", registrationTrModel.userModel.EmailAddress),
                    new KeyValuePair <string, string>("password", SecureStringToString(securePassword))
                });
                registrationTrModel.EncodedContent = data;

                using (HttpResponseMessage response = await apiClient.PostAsJsonAsync("api/User/Register", registrationTrModel))
                {
                    if (response.IsSuccessStatusCode)
                    {
                        return(response.StatusCode);
                    }
                    else
                    {
                        throw new Exception(response.ReasonPhrase);
                    }
                }
            }
            else
            {
                throw new Exception("Password and Confirm Password do not match");
            }
        }
Example #3
0
        public RegisterUserViewModel(IMvxNavigationService mvxNavigation, ISubjectOfInterestModelList subjectsOfInterestModel, ISubjectOfInterestModel subjectOfInterestModel, IApiHelper apiHelper, IUserRegistrationTrModel registrationTrModel)
        {
            this._apiHelper           = apiHelper;
            this._registrationTrModel = registrationTrModel;
            Passport = GetImage(Resources.Female_Icon, Passport);

            OperatingSystem operatingSystem = Environment.OSVersion;

            Upload = new MvxCommand(UploadCommand);
            Remove = new MvxCommand(RemoveSelectedSubjectCommand);/*MvxAsyncCommand*/
            this._mvxNavigation          = mvxNavigation;
            this._subjectsOfInterest     = subjectsOfInterestModel;
            this._subjectOfInterestModel = subjectOfInterestModel;

            Task.Run(() => GetSubjectOfInterest()).Wait();

            SubjectsAndNotes = new BindingList <SubjectOfInterestModel>(_subjectsOfInterest.SubjectOfInterestModels);
        }