Пример #1
0
        public static async Task<bool> ValidateUser(User user)
        {
            string jsonObj = JsonConvert.SerializeObject(user);
            HttpContent content = new StringContent(jsonObj, Encoding.UTF8, "application/json");
            HttpResponseMessage response = await DAO.Client.PutAsync("api/users/validate", content);

            return response.IsSuccessStatusCode;
        }
        private async void ExecuteCreateUserCommand()
        {
            User user = new User()
            {
                Name = FirstName,
                Surname = LastName,
                Password = NewUserView.GetPassword()
            };

            FirstName = string.Empty;
            LastName = string.Empty;
            NewUserView.SetPassword(string.Empty);

            if (await UsersDAO.CreateUser(user))
                MessageBox.Show("Пользователь создан успешно");
        }