Ejemplo n.º 1
0
        public static void Registration(NewUserHelper user)
        {
            var client  = new RestClient(serverURl + userRoute);
            var request = new RestRequest("registration", Method.POST);

            request.RequestFormat = DataFormat.Json;
            request.AddJsonBody(user);
            IRestResponse response = client.Execute(request);

            HttpStatusCode statusCode        = response.StatusCode;
            int            numericStatusCode = (int)statusCode;

            CheckExceptions(numericStatusCode, response.Content);
        }
 private void btRegistartion_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         NewUserHelper newUser = new NewUserHelper();
         newUser.email    = tbRegEmail.Text;
         newUser.username = tbRegUsername.Text;
         newUser.name     = tbFullname.Text;
         newUser.password = tbPassword.Password;
         newUser.isAdmin  = cbNewUserAdmin.IsEnabled;
         ApiController.Registration(newUser);
         GridRegistration.Visibility = Visibility.Hidden;
         GridLogin.Visibility        = Visibility.Visible;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }