diff --git a/MangaMap/App.xaml.cs b/MangaMap/App.xaml.cs index 24756ad..cc74198 100644 --- a/MangaMap/App.xaml.cs +++ b/MangaMap/App.xaml.cs @@ -7,11 +7,14 @@ public partial class App : Application { public Manager MyManager { get; private set; } = new Manager(); + public Admin MyAdmin { get; private set; } = new Admin("test", "test@test.ts", "Pseudo_test"); + public App() { InitializeComponent(); + MyManager.ajouterAdministrateur(MyAdmin); MainPage = new AppShell(); - + MyManager.charger(); } } diff --git a/MangaMap/Model/Admin.cs b/MangaMap/Model/Admin.cs index 9ae0a3a..23a1969 100644 --- a/MangaMap/Model/Admin.cs +++ b/MangaMap/Model/Admin.cs @@ -16,10 +16,6 @@ namespace MangaMap.Model Pseudo = pseudo; } - public int Id { get; private set; } - - - public void ajouterAnime() { } public void supprimerAnime() { } diff --git a/MangaMap/Model/Manager.cs b/MangaMap/Model/Manager.cs index db9593a..ffc2982 100644 --- a/MangaMap/Model/Manager.cs +++ b/MangaMap/Model/Manager.cs @@ -23,5 +23,26 @@ namespace MangaMap.Model { Utilisateurs.Add(u); } + + public void ajouterAdministrateur(Admin a) + { + Admins.Add(a); + } + + public void ajouterOeuvre(Oeuvre o) + { + Oeuvres.Add(o); + } + + public void charger() + { + Utilisateur u1 = new Utilisateur("test@test.ts", "Pseudo1", "MotDePasse123", "Jean", "Baptiste", 12); + Utilisateur u2 = new Utilisateur("test@test.ts", "Pseudo2", "MotDePasse123", "Baptiste", "Jean", 12); + Utilisateur u3 = new Utilisateur("test@test.ts", "Pseudo3", "MotDePasse123", "David", "Marc", 12); + + ajouterUtilisateur(u1); + ajouterUtilisateur(u2); + ajouterUtilisateur(u3); + } } } diff --git a/MangaMap/Views/homePage.xaml b/MangaMap/Views/homePage.xaml index 3a2e598..97bb044 100644 --- a/MangaMap/Views/homePage.xaml +++ b/MangaMap/Views/homePage.xaml @@ -2,19 +2,24 @@ + + + + - - - - - - - - - - - + + @@ -67,8 +72,8 @@ - - + + - - + + - + + + + + + + + + + - - + + \ No newline at end of file diff --git a/MangaMap/Views/homePage.xaml.cs b/MangaMap/Views/homePage.xaml.cs index 89f558a..832d230 100644 --- a/MangaMap/Views/homePage.xaml.cs +++ b/MangaMap/Views/homePage.xaml.cs @@ -1,10 +1,14 @@ namespace MangaMap.Views; +using MangaMap.Model; + public partial class homePage : ContentPage { - public homePage() + public Manager my_manager => (App.Current as App).MyManager; + + public homePage() { InitializeComponent(); + a1.BindingContext = my_manager; } - } \ No newline at end of file diff --git a/MangaMap/Views/signUpPage.xaml.cs b/MangaMap/Views/signUpPage.xaml.cs index 190f906..19a9e15 100644 --- a/MangaMap/Views/signUpPage.xaml.cs +++ b/MangaMap/Views/signUpPage.xaml.cs @@ -24,6 +24,12 @@ public partial class signUpPage : ContentPage string password = passwordEntry.Text; string confirmPassword = confirmPasswordEntry.Text; + if (age < 5) + { + await DisplayAlert("Erreur", "Il faut avoir au minimum 5 ans pour utiliser l'application.", "OK"); + return; + } + if (string.IsNullOrWhiteSpace(email) || string.IsNullOrWhiteSpace(password) || string.IsNullOrWhiteSpace(confirmPassword)) { @@ -54,11 +60,10 @@ public partial class signUpPage : ContentPage if (password == confirmPassword) { await Navigation.PushAsync(new homePage()); + Utilisateur util = new Utilisateur(email, pseudo, password, nom, prénom, age); + my_manager.ajouterUtilisateur(util); + return; } - - Utilisateur util = new Utilisateur(email, pseudo, password, nom, prénom, age); - my_manager.ajouterUtilisateur(util); - } bool IsPasswordStrong(string password)