private void Button_Click(object sender, RoutedEventArgs e) { string username = this.tbUsernam.Text.ToLower(); string password = this.pbPassword.Password; List <User> users = new List <User>(); try { users = _loginService.Login(username, password); User user = users.Single(s => s.Username.ToLower() == username); if (user.IsAdmin == false) { ManageMechanics manageMechanics = new ManageMechanics(); List <Mechanic> mechanics = manageMechanics.AllMechanics(); Mechanic mechanic = mechanics.Single(x => x.IdNumber == user.MechanicId); MechanicHome mechanicHomePage = new MechanicHome(mechanic); this.NavigationService.Navigate(mechanicHomePage); } else { AdminHome adminHomePage = new AdminHome(); this.NavigationService.Navigate(adminHomePage); } } catch { MessageBox.Show(_errorMsg); this.tbUsernam.Clear(); this.pbPassword.Clear(); } }
private void goBackButton_Click(object sender, RoutedEventArgs e) { MechanicHome mechanicHome = new MechanicHome(Mechanic); this.NavigationService.Navigate(mechanicHome); }