private void Registration_button_Click(object sender, EventArgs e) { if (ValidateInput()) { IUserService userService = new UserServiceXmlRepository(); var newUser = new UserModel { FirstName = FirstName_textbox.Text, LastName = LastName_textBox.Text, Email = Email_textbox.Text, PrivateNumber = PrivateNumber_textbox.Text, Password = Password_textbox.Text }; if (userService.RegisterUser(newUser)) { UserRegistered?.Invoke(this, newUser); Close(); } else { RegistrationError_label.Visible = true; } } }
private void LoginUser(UserModel user) { IUserService userService = new UserServiceXmlRepository(); var logedUser = userService.LoginUser(user); if (logedUser != null) { var MainForm = new MainForm(logedUser); MainForm.Show(); Hide(); } else { Error_label.Visible = true; } }