public static User ConvertUser(ViewUser viewUser)
 {
     return new User
     {
         UserID = viewUser.UserID,
         Name = viewUser.Name,
         Surname = viewUser.Surname,
         PhoneNumber = viewUser.PhoneNumber,
         Email = viewUser.Email
     };
 }
        public UserWindow(ViewUser User)
        {
            InitializeComponent();

            viewUser = User;
            if (User.UserID > 0)
            {
                Button_Correct.IsEnabled = true;
                Button_Add.IsEnabled = false;

                TextBox_Name.Text = viewUser.Name;
                TextBox_Surname.Text = viewUser.Surname;
                TextBox_PhoneNumber.Text = viewUser.PhoneNumber;
                TextBox_Email.Text = viewUser.Email;
            }
            else
            {
                Button_Correct.IsEnabled = false;
                Button_Add.IsEnabled = true;
            }
        }
 public void AddUser(ViewUser user)
 {
     DataManager.AddUserToDb(DbConverter.ConvertUser(user));
 }
 public void DeleteUser(ViewUser user)
 {
     DataManager.DeleteUserFromDb(DbConverter.ConvertUser(user));
 }
 public void UpdateUser(ViewUser user)
 {
     DataManager.UpdateUserFromDb(DbConverter.ConvertUser(user));
 }