private void btnCreate_Click(object sender, RoutedEventArgs e)
        {
            user = new User()
            {
                Id        = Guid.Empty,
                FirstName = txtFirstName.Text,
                LastName  = txtLastName.Text,
                Email     = txtEmail.Text,
                Phone     = txtPhone.Text,
                Password  = txtPassword.Password
            };

            int result = UserManager.Insert(user);

            if (result >= 1)
            {
                payment = new UserPayment()
                {
                    Id             = Guid.Empty,
                    UserId         = user.Id,
                    CardHolderName = txtCardHolderName.Text,
                    CardNumber     = txtCardNumber.Text,
                    ExpirationDate = txtExpirationDate.Text,
                    CVC            = txtCVC.Text
                };

                address = new UserAddress()
                {
                    Id      = Guid.Empty,
                    UserId  = user.Id,
                    Address = txtAddress.Text,
                    City    = txtCity.Text,
                    StateId = cboState.SelectedIndex,
                    ZipCode = txtZip.Text
                };

                Guid id = user.Id;

                bool paymentresult = UserPaymentManager.Insert(payment);
                bool addressresult = UserAddressManager.Insert(address);

                if (paymentresult && addressresult)
                {
                    this.Close();
                    new LoginWindow().ShowDialog();
                }
                else
                {
                    UserManager.Delete(user.Id);
                    MessageBox.Show("An Error Occurred. Invaild Data Entered for Address or Payment");
                }
            }
            else
            {
                MessageBox.Show("An Error Occurred. Invalid Data Entered for User.");
            }
        }
Пример #2
0
        public void InsertTest()
        {
            Guid userId = UserManager.Load().FirstOrDefault().Id;

            UserAddress useraddress = new UserAddress
            {
                UserId  = userId,
                Address = "123 EZ Street",
                City    = "OshkoshTest",
                State   = "WI",
                ZipCode = "54913"
            };

            bool result = UserAddressManager.Insert(useraddress);

            Assert.IsTrue(result);
        }
Пример #3
0
 // POST: api/UserAddress
 public void Post([FromBody] UserAddress make)
 {
     UserAddressManager.Insert(make);
 }