Esempio n. 1
0
        public void CreateUpdateDelete()
        {
            var u = new UserUpsert {
                Email          = "*****@*****.**",
                Bio            = "bio",
                CanCreateGroup = true,
                IsAdmin        = true,
                Name           = "sadfasdf",
                Password       = "******",
                ProjectsLimit  = 1000,
                Skype          = "skype",
                Twitter        = "twitter",
                Username       = "******",
                WebsiteUrl     = "wp.pl"
            };

            var addedUser = users.Create(u);

            Assert.AreEqual(u.Bio, addedUser.Bio);

            u.Bio   = "Bio2";
            u.Email = "*****@*****.**";

            var updatedUser = users.Update(addedUser.Id, u);

            Assert.AreEqual(u.Bio, updatedUser.Bio);

            users.Delete(addedUser.Id);
        }
        private void Submit_ButtonClicked(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(EmailTextBox.Text) || string.IsNullOrEmpty(EmployeeNameTextBox.Text))
            {
                MessageBox.Show("Please, fill all fields");
                return;
            }

            UpdateUserFields();

            var result  = User.Id == 0 ? Client.Create(User) : Client.Update(User);
            var resText = result.IsSuccess ? "Operation successful" : "Operation failed: \n" + result.Message;

            MessageBox.Show(resText);
            if (result.IsSuccess)
            {
                this.Close();
            }
        }