private void OnClientRegWndClosed(object sender, EventArgs e)
        {
            ClientRegistrationWindow window = sender as ClientRegistrationWindow;

            window.Closed -= OnClientRegWndClosed;
            if (window.DialogResult != null && window.DialogResult.Value)
            {
                UserRegistrationPropertiesViewModel vm = window.DataContext
                                                         as UserRegistrationPropertiesViewModel;
                if (vm == null)
                {
                    throw new ArgumentException("Wrong object type");
                }
                User   client   = vm.Model;
                string password = vm.Password;
                client.PasswordHash = Sha256Hash.Calculate(password);
                registeredClient    = client;
                ProcessMissingFields(client);
                UserRegistrator registrator = new UserRegistrator(client,
                                                                  OnClientRegistered, OnError);
                progressWindow         = new UserRegistrationProgressWindow(registrator);
                progressWindow.Closed += OnRegistrationWindowClosed;
                progressWindow.Show();
            }
        }
예제 #2
0
        public IHttpActionResult Register(RegistrationRequest registrationRequest)
        {
            UserRegistrator    userRegistrator = new UserRegistrator();
            RegistrationStatus registrationStatus;
            UserDto            userDto = userRegistrator.RegisterNewUser(registrationRequest, out registrationStatus);

            if (userDto == null)
            {
                return(BadRequest(registrationStatus.ToString()));
            }

            return(Ok(userDto));
        }