private void btnPrijavaNatrag_Click(object sender, EventArgs e) { this.Hide(); FirstForm firstForm = new FirstForm(); firstForm.Closed += (s, args) => this.Close(); firstForm.Show(); }
private void button1_Click(object sender, EventArgs e) { List <Users> users = new List <Users>(); users = _moviesRepository.GetAllUsers(); string username = txtKorisnickoIme.Text; string email = txtEmail.Text; string password1 = txtLozinka1.Text; string password2 = txtLozinka2.Text; var brojac = 0; if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(email) && !string.IsNullOrEmpty(password1) && !string.IsNullOrEmpty(password2)) { if (password1 == password2) { foreach (var user in users) { if (user.Email == email) { string text = "Taj email je već registriran!"; msg m = new msg(text); m.ShowDialog(); brojac++; break; } if (user.Username == username) { string text = "To kosničko ime je zauzeto!"; msg m = new msg(text); m.ShowDialog(); brojac++; break; } } if (brojac == 0) { DodajUsera(username, email, password1); string text = "Korisnik uspješno registriran!"; msg m = new msg(text); m.ShowDialog(); this.Hide(); FirstForm firstForm = new FirstForm(); firstForm.Closed += (s, args) => this.Close(); firstForm.Show(); } } else { string text = "Lozinke se ne podudaraju!"; msg m = new msg(text); m.ShowDialog(); } } else { string text = "Niste ispunili sve upite!"; msg m = new msg(text); m.ShowDialog(); } }