Compare commits

...

337 Commits

Author SHA1 Message Date
Antoine JOURDAIN b8e1f9b759 Mise à jour de 'README.md'
continuous-integration/drone/push Build was killed Details
1 year ago
Antoine JOURDAIN 777e985cc4 Ajout MS Project
continuous-integration/drone/push Build is passing Details
1 year ago
Patrick BRUGIERE 59529cfac1 Ajout des rapport d'activités
continuous-integration/drone/push Build is passing Details
1 year ago
PATRICK 7c08ed8235 switch
continuous-integration/drone/push Build is passing Details
1 year ago
Patrick BRUGIERE 5f00cd91f4 ajout dockerfile
continuous-integration/drone/push Build is passing Details
1 year ago
Patrick BRUGIERE 9b24026104 push dockerfile
continuous-integration/drone/push Build is passing Details
1 year ago
Patrick BRUGIERE e748a047be Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
1 year ago
Patrick BRUGIERE 4dd9ce51ce Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
1 year ago
Patrick BRUGIERE 2a29bf3b4c Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
1 year ago
Patrick BRUGIERE 532b3295f5 enorme avancer normalement le dernier commit. Corrections des Many To Many qui marchent tous, plus aucun probleme avec la bd, tous les Test marches et ajout du JWT fonctionnel.
continuous-integration/drone/push Build is passing Details
1 year ago
Patrick BRUGIERE 679dfc1717 grosse avancer il reste a faire les test consoles API et faire les routes dans les controller pour utiliser les many to many
continuous-integration/drone/push Build is passing Details
1 year ago
Patrick BRUGIERE 4be6349f81 fin des test unitaires
continuous-integration/drone/push Build is passing Details
1 year ago
PATRICK 2cdfc6b367 travail sur les TU
continuous-integration/drone/push Build is passing Details
1 year ago
PATRICK da15b2befb j'ai enfin réussi a trouver comment faire fonctionner les TU
continuous-integration/drone/push Build is passing Details
1 year ago
Patrick BRUGIERE 836922cb34 correction des controller et ajout du versionning mais TU a revoir
continuous-integration/drone/push Build is passing Details
1 year ago
PATRICK 042e954a08 optimisation des TU
continuous-integration/drone/push Build is passing Details
1 year ago
PATRICK f4130e659a les controller sont normalement fini
continuous-integration/drone/push Build is passing Details
1 year ago
Patrick BRUGIERE 48f71d38ff avancer sur les controllers
continuous-integration/drone/push Build is passing Details
1 year ago
Patrick BRUGIERE bf3bda5fe1 avancement sur la creation des controllers et des services
continuous-integration/drone/push Build is passing Details
1 year ago
PATRICK e08cc0df05 avancer
continuous-integration/drone/push Build is passing Details
1 year ago
PATRICK 7bc5aea9da avancer
continuous-integration/drone/push Build is passing Details
1 year ago
PATRICK 200c4b2995 ajout des TU et de l'Api avec pour l'instant les choses faite seulement pour la classe groupes, mais dcp il suffira de recopier pour le reste normalement
continuous-integration/drone/push Build is passing Details
1 year ago
PATRICK af735b1541 suppression de fichier inutile
continuous-integration/drone/push Build is passing Details
1 year ago
PATRICK d8a0480307 avancer
continuous-integration/drone/push Build is passing Details
1 year ago
Patrick BRUGIERE faae69f8b6 ajout des relations
continuous-integration/drone/push Build is passing Details
1 year ago
Patrick BRUGIERE d7479939b1 debut entityFramework
continuous-integration/drone/push Build is passing Details
1 year ago
Patrick BRUGIERE a9d865325d premiere avancer
continuous-integration/drone/push Build is passing Details
1 year ago
Patrick BRUGIERE e8d14e7602 premiere avancer
continuous-integration/drone/push Build is passing Details
1 year ago
Patrick BRUGIERE 3ea94dc844 Mise à jour de '.gitignore'
continuous-integration/drone/push Build is passing Details
1 year ago
Patrick BRUGIERE 815dfa3042 fusions
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine JOURDAIN c138fad888 Passage en français
1 year ago
Antoine JOURDAIN f8f6ca0828 MAJ readme
1 year ago
Antoine JOURDAIN 5a2d06b1c9 MAJ readme
1 year ago
Patrick BRUGIERE 1ca603b186 Transférer les fichiers vers ''
1 year ago
Antoine JOURDAIN dfcd0c3dfb Description des diagrammes
1 year ago
Lucie GOIGOUX 94c63f5173 Ajout du diagramme de cas d'utilisation
1 year ago
Antoine JOURDAIN 68c9cdbcd2 Diagramme de classe
1 year ago
Anthony RICHARD 1ff03b03ff diagramme de classe
1 year ago
Anthony RICHARD 2304a18226 fix types de retour + protected
1 year ago
Anthony RICHARD 366e95f909 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD d96bcb3411 fin du css
1 year ago
Patrick BRUGIERE 44c1f06f1c modif de la vue d erreur
1 year ago
Patrick BRUGIERE 8967d45f7c Merge remote-tracking branch 'origin/php' into php
1 year ago
Patrick BRUGIERE 6ecc99a6e3 modification de certain catch new exception et ajout d'un pour les liste trop courte pour le quiz
1 year ago
Anthony RICHARD 8cc18109db + de css
1 year ago
Anthony RICHARD 986e55a3d8 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD 7b18767eed +de css
1 year ago
Patrick BRUGIERE 3dab5c8a0e ajout d'image
1 year ago
Lucie GOIGOUX cbb9f3bbec Fix page
1 year ago
Lucie GOIGOUX cfa6474e3c Merge
1 year ago
Lucie GOIGOUX ffefe0d0b9 Fix et ajout navBar sur le quiz
1 year ago
Patrick BRUGIERE 382f16e8e9 modification quiz
1 year ago
Patrick BRUGIERE 8c513cbd78 Merge remote-tracking branch 'origin/php' into php
1 year ago
Patrick BRUGIERE d0a638d275 magnifique image de fond pour la vue d'erreur
1 year ago
Lucie GOIGOUX 79f10db489 Modif navBar
1 year ago
Lucie GOIGOUX 290816a839 merge
1 year ago
Lucie GOIGOUX 6b786c7529 modif de la view du choix des jeux ----> fonctionne ;)
1 year ago
Anthony RICHARD 728b476fb8 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD 6e3b824790 css groupView
1 year ago
Antoine JOURDAIN ca5081f870 Ajout Favicon
1 year ago
Lucie GOIGOUX 1570115665 Changement navBar
1 year ago
Lucie GOIGOUX 404b293af7 ajout fonction game et changement navbar
1 year ago
Lucie GOIGOUX 7322210432 Ajout nouvelle view
1 year ago
Lucie GOIGOUX a909fc5065 Fix
1 year ago
Anthony RICHARD aaf8dc0110 c mieux
1 year ago
Anthony RICHARD db92efc3a1 addvocab
1 year ago
Anthony RICHARD 70f34d0d75 link teacher
1 year ago
Anthony RICHARD bee868e5c4 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD 8e4b435084 on voit que les listes du teacher
1 year ago
Lucie GOIGOUX 1e172fa9ba Implementation de la demo + liens entre les pages
1 year ago
Patrick BRUGIERE 2960fae3a7 Merge remote-tracking branch 'origin/php' into php
1 year ago
Patrick BRUGIERE 26e98ed144 ajout d'un fonction pour que le teacher vois que ses listes
1 year ago
Anthony RICHARD b5847a5474 presque tout qui marche sur listview
1 year ago
Anthony RICHARD 07819a17ca Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD ff80500986 vocabListView
1 year ago
Lucie GOIGOUX c56b077ea8 merge
1 year ago
Lucie GOIGOUX cb85102b3d Ajout vocablist
1 year ago
Lucie GOIGOUX fbfbb27474 Création vue vocabList
1 year ago
Lucie GOIGOUX 1254b0a81f Création vue vocabList
1 year ago
Anthony RICHARD 36e559ff8e Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD 6b01bcf4a1 vocablist
1 year ago
Antoine JOURDAIN 9c8987cb57 Favicon + modif navBar
1 year ago
Patrick BRUGIERE c2f964fb86 avancement sur l'affichage le la liste de vocabulaire par user
1 year ago
Patrick BRUGIERE cc8dc57ef2 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Patrick BRUGIERE 1f9ef8b535 vocab
1 year ago
Antoine JOURDAIN b2b4503719 Détails visuels
1 year ago
Antoine JOURDAIN dd1450e417 Ajout score dans memory
1 year ago
Anthony RICHARD 6353b83a16 fix oublie de boutons sur la usersView
1 year ago
Anthony RICHARD f16c0de702 fix plusieurs petits bugs
1 year ago
Anthony RICHARD b815dbef75 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD c7618a1a22 fix route header home
1 year ago
Anthony RICHARD acb6d1a79e fix modify password et nickname (maintenant le $user est update)
1 year ago
Patrick BRUGIERE 075116f173 Merge remote-tracking branch 'origin/php' into php
1 year ago
Patrick BRUGIERE ea5f419ad0 On peut enfin ajouter un vocabulaire à partir de la vue
1 year ago
Antoine JOURDAIN 945263d1f0 Fix nav bar
1 year ago
Anthony RICHARD 32043c5f8c little fix
1 year ago
Anthony RICHARD 3c195bddac Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD d5c5e10742 fix myaccountview
1 year ago
Anthony RICHARD 75c4cdd7ca Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD 1a7580879a modif myaccountview
1 year ago
Patrick BRUGIERE 3d6455ed57 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Patrick BRUGIERE fdb77f98ef mise du css sur le manageVocabListView
1 year ago
Lucie GOIGOUX c4e9928fbd Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Lucie GOIGOUX 161756fd79 AJOUT DE LA NAVBAR
1 year ago
Patrick BRUGIERE d11714182e Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Patrick BRUGIERE 31572ccfb6 modification de la view
1 year ago
Anthony RICHARD 7e481ff0f8 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD 6b6d1176fe Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD d023a0ca52 routes
1 year ago
Lucie GOIGOUX ae2f566d07 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Lucie GOIGOUX 76e58f4efc modif
1 year ago
Antoine JOURDAIN 81689755a5 Transition des cartes
1 year ago
Anthony RICHARD 1a391d93d5 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD 790f8b6fd0 séparation user visitor
1 year ago
Patrick BRUGIERE 133880f019 Merge remote-tracking branch 'origin/php' into php
1 year ago
Patrick BRUGIERE 41b660a88c modification des view pour quelles fonctionnent avec le altoRouteur
1 year ago
Lucie GOIGOUX 45953fca03 navBar
1 year ago
Lucie GOIGOUX daf0bc4fdd navBar
1 year ago
Anthony RICHARD 96bcee3e5d Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD faedf5654e suite
1 year ago
Anthony RICHARD 090f0c0025 front avec userID
1 year ago
Patrick BRUGIERE 61e3c5bb36 legere modification de la db pour la rendre a nouveau fonctionnel
1 year ago
Patrick BRUGIERE 2a267099ca Merge remote-tracking branch 'origin/php' into php
1 year ago
Patrick BRUGIERE 146f84b08a rajout d'un if pour gérer une erreur (logpass et logemail)
1 year ago
Antoine JOURDAIN 27bff55684 Link logo sur page + jeu
1 year ago
Lucie GOIGOUX 6e56a2bb8d Ajout de l'image des cartes du memory
1 year ago
Lucie GOIGOUX cdcb2172f4 Ajout du logo de l'application
1 year ago
Antoine JOURDAIN 88c591568c Refractor AbsController -> UserController
1 year ago
Antoine JOURDAIN 4f1f9fa466 Fix login + css
1 year ago
Antoine JOURDAIN 4bf463ffdd Ajout INSERT
1 year ago
Anthony RICHARD 657d7fb711 meilleure gestion d'erreur + affichage nom de la liste à la place de quiz
1 year ago
Anthony RICHARD 4877d9b4ac css quiz
1 year ago
Anthony RICHARD eea9ddcd78 c'est moche mais c'est mieux
1 year ago
Anthony RICHARD 9aa4ab4676 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD 577d0872d7 le gaming
1 year ago
Antoine JOURDAIN 66c5406279 Fix action resultatsJeux
1 year ago
Antoine JOURDAIN 05545ffe4f Ajout vu résultat
1 year ago
Anthony RICHARD 43066a391b Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD ee57c9bb57 début quiz
1 year ago
Antoine JOURDAIN 9fa1d67cb7 Fix base
1 year ago
Antoine JOURDAIN e34d86588e C'est de la faute à Antho si y a ce commit
1 year ago
Antoine JOURDAIN 0c7688cba1 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Antoine JOURDAIN 0d2f00fcd3 le JS, c'est bien.
1 year ago
Antoine JOURDAIN b14cf629fe Jouabilité du memory
1 year ago
Patrick BRUGIERE 778ebc0310 travail sur la vue du quiz
1 year ago
Patrick BRUGIERE d23d7d8270 travail sur la vue du quiz
1 year ago
Anthony RICHARD b4c0bedde6 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD 3f21482d73 altorouter
1 year ago
Lucie GOIGOUX 975b4a80a6 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Lucie GOIGOUX 6d86f03336 ajout de la vue des résultats de jeux
1 year ago
Anthony RICHARD f154a1717b Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD c59733d6b8 rangement
1 year ago
Patrick BRUGIERE 58aefe864e le quiz marche avec l'autoloader maintenant
1 year ago
Patrick BRUGIERE 8ea6de1dbd avancement du quiz
1 year ago
Patrick BRUGIERE 54bbd3e5a9 avancement du quiz
1 year ago
Anthony RICHARD c38194573b fix login
1 year ago
Antoine JOURDAIN a63a94e6ba Fix mdp invalide
1 year ago
Patrick BRUGIERE d1cedcce77 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Patrick BRUGIERE 6a466b062b avancement du quiz
1 year ago
Antoine JOURDAIN eda6889e04 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Antoine JOURDAIN 3ffc62373e Modif jeu
1 year ago
Antoine JOURDAIN 85c314b9e2 Fix DB
1 year ago
Patrick BRUGIERE 0ad8c09673 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Patrick BRUGIERE 9c3c014117 avancement du quiz
1 year ago
Antoine JOURDAIN c3ab480257 Avancement Memory
1 year ago
Antoine JOURDAIN c73cc60d80 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Antoine JOURDAIN 72330c287c Fix
1 year ago
Patrick BRUGIERE 6e5fd079fb debut de travail sur le jeu quiz
1 year ago
Patrick BRUGIERE 1c64a43e06 début de travail sur le quizz et sur sa vue
1 year ago
Antoine JOURDAIN ecda59e3a0 Fix
1 year ago
Lucie GOIGOUX bb04f79f9b début memory
1 year ago
Antoine JOURDAIN 61c24e12b5 Suppression oublie vardump
1 year ago
Lucie GOIGOUX 020a43e418 extends controller to absController + modif Student
1 year ago
Lucie GOIGOUX 5f6e578362 ajout de l'absController pour les jeux et les fonctions communes
1 year ago
Anthony RICHARD 4a153a0bb4 dernière fonctions de login
1 year ago
Anthony RICHARD f6d2c640f9 Merge branch 'master' into php
1 year ago
Patrick BRUGIERE 017c661b0e ajout d'une fonction pour ne pas pouvoir utilisé un id qui n'est pas dans la base de donnée et ,j'ai fait les is pour admin et student (a revoir)
1 year ago
Patrick BRUGIERE dbb85c2c68 modification du modele de student et de son controller pour rendre certaines methodes fonctionnel, début de modification du frontController pour rendre les connexion plus securisé
1 year ago
Patrick BRUGIERE 899071b307 on peut maintenant supprimer un vocabulaire sur la vue , mais j'ai du modifié un peu une fonction de la gateway teacher pour cela
1 year ago
Antoine JOURDAIN 915782d514 Modification tablette
1 year ago
Patrick BRUGIERE 42402faa05 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Patrick BRUGIERE f9cec2d223 on peut maintenant afficher la fonction getByName dans teacher
1 year ago
Anthony RICHARD 7a13dc682b connexion (normalement c'est ok cette fois)
1 year ago
Anthony RICHARD 7434afb243 connexion marche pas encore
1 year ago
Anthony RICHARD fdb1774249 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD 7ea8b0cd63 fix scripts db
1 year ago
Patrick BRUGIERE 9e2d054bd3 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Patrick BRUGIERE 7bdb345e12 "ajout de la vue pour les vocabulaire et de son manager (encore du travail dessus)"
1 year ago
Lucie GOIGOUX 337f437e5a Ajout de la navBar des futurs sessions connectées
1 year ago
Lucie GOIGOUX dc2a50dccd Mise à jour de 'Project/php/css/styles.css'
1 year ago
Anthony RICHARD 7b1a41cc53 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD 60f323aea7 connection back
1 year ago
Antoine JOURDAIN 96a1c7005d Lien entre home et login via action
1 year ago
Anthony RICHARD 1cc1128b00 altorouter + fix des liens dans les pages
1 year ago
Patrick BRUGIERE ef6b71e19b travail sur la vue pour teacher
1 year ago
Antoine JOURDAIN 81b2877c31 Merge php to master
1 year ago
Antoine JOURDAIN 6a3d2bd6d0 MAJ diag classe
1 year ago
Anthony RICHARD 670df4002c pouf
1 year ago
Antoine JOURDAIN 8ff6b69ed1 MAJ
1 year ago
Lucie GOIGOUX 4669e0ef5f Mise à jour de 'Documentation/diagClasse.md'
1 year ago
Antoine JOURDAIN 7fb3641e6c Modif BD
1 year ago
Anthony RICHARD 169a20889b Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
1 year ago
Anthony RICHARD 4dfa84006f début des vocabs
1 year ago
Anthony RICHARD 59bd40aea2 les use useless
1 year ago
Anthony RICHARD 1eb6629cd1 fix je suis débile 2
1 year ago
Antoine JOURDAIN 3fef3081fa Mise à jour de 'Project/db/mld.md'
1 year ago
Antoine JOURDAIN ab4844f345 Mise à jour de 'Project/db/mcd.md'
1 year ago
Anthony RICHARD 093ccefa98 validation myaccountview et ses actions
1 year ago
Anthony RICHARD 967aabb3e4 ajout fonction pour valider password
1 year ago
Anthony RICHARD b29f3c3e3c fix inversion des deux fonctions (je suis débile)
1 year ago
Anthony RICHARD d84c43faba fix fonctions modify group après changement DB
1 year ago
Anthony RICHARD 5bfb7074f1 fix error group gateway
1 year ago
Anthony RICHARD 09b7c93821 ajout validation dans admin controller
1 year ago
Anthony RICHARD 38da4e87f1 ajout validation dans front controller
1 year ago
Anthony RICHARD e70e46f99f fonctions de validation pour la plupart des entrées + pour l'action
1 year ago
Anthony RICHARD adf25ebb1c Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
2 years ago
Anthony RICHARD f6d4ea7a56 modif du password en template twig
2 years ago
Antoine JOURDAIN 47ea602b47 Affichage role et extra time
2 years ago
Antoine JOURDAIN a9a7a358b3 Fix requete UnassignedUsers
2 years ago
Antoine JOURDAIN 81fd523b69 Fix pour nouvelle BD
2 years ago
Antoine JOURDAIN b7590c9ac7 Fix par rapport à nouvelle BD
2 years ago
Antoine JOURDAIN a561e00fe5 Correspondance avec la nouvelle conception de la BD pour liste de vocabulaire
2 years ago
Anthony RICHARD 6b9657ac53 implémentation des actions de la page my account (show + modify password + modify nickname)
2 years ago
Anthony RICHARD 597103b4e4 case null renvoie vers home.html + meilleures exceptions (normalement)
2 years ago
Anthony RICHARD e065f9e77b fin fix $con
2 years ago
Anthony RICHARD e6a8a556c5 plus besoin de mettre de paramètres $con dans les gateways
2 years ago
Anthony RICHARD 3bb1ee8e6f vue my account (voir info user + modif password + modif nickname)
2 years ago
Anthony RICHARD a5a7afe0e6 modif txt home.html
2 years ago
Anthony RICHARD 069e32c5d4 template du formulaire pour ajouter un groupe
2 years ago
Anthony RICHARD 156cdbbd29 implémentation du frontcontroller
2 years ago
Anthony RICHARD 3d91d8f03d séparation de la page group view en templates twig
2 years ago
Anthony RICHARD 84d23f0478 fix bug css/media pas visibles sur pages
2 years ago
Antoine JOURDAIN 837fd0bd7b MAJ User + ajout insertion par défaut
2 years ago
Antoine JOURDAIN ee38ff637e MAJ correspondance nouvelle conception
2 years ago
Antoine JOURDAIN 6f3eb214d8 Ajout rapport BD
2 years ago
Anthony RICHARD 4962a0ed80 meilleure redirections
2 years ago
Anthony RICHARD 6ee3b356f7 implémentation de l'action addUserToGroup
2 years ago
Anthony RICHARD f22ac75b59 implémentation addGroup removeUserFromGroup removeGroup
2 years ago
Anthony RICHARD 9efefc32eb MERGE
2 years ago
Anthony RICHARD 4bd5e6e73d modifs sur la user view
2 years ago
Anthony RICHARD 0e0674539c mise a jour des gateways après modifs dans la classe mère
2 years ago
Anthony RICHARD 412a7a7363 implémentation de l'admin controller
2 years ago
Anthony RICHARD 52357b3635 modele de l'admin
2 years ago
Anthony RICHARD 5e27236466 group view
2 years ago
Patrick BRUGIERE 6fadab3869 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_1A_Anglais into php
2 years ago
Patrick BRUGIERE e8c99b9413 "ajout du modele et du controleur de teacher"
2 years ago
Antoine JOURDAIN 0df1644b62 Ajout id et affichage role, extra time
2 years ago
Lucie GOIGOUX 1c6a5c04d0 formulaire ajout user
2 years ago
Lucie GOIGOUX bda9ee44d7 formulaire ajout user
2 years ago
Patrick BRUGIERE afe2328743 finition du controller de student
2 years ago
Anthony RICHARD f8f945cda5 user gateway fixc
2 years ago
Anthony RICHARD ab06aacb7a fix absGateway
2 years ago
Patrick BRUGIERE 763ec534bf Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
2 years ago
Patrick BRUGIERE 5e8b1f62a6 travail sur la gateway de student
2 years ago
Lucie GOIGOUX e748f6b732 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
2 years ago
Lucie GOIGOUX 8a1196f87a ajout bouton delete
2 years ago
Lucie GOIGOUX ba2969dc0d ajout bouton delete
2 years ago
Anthony RICHARD 01384314bb ajout actions show all sur admin
2 years ago
Lucie GOIGOUX e21aba99e3 ajout des vues + de la page home
2 years ago
Leon ENAULT 6b23d426b6 clarification de commentaires
2 years ago
Anthony RICHARD 3f86ce7f86 implémentation de la classe AbsModel (inchallah c'était une bonne idée)
2 years ago
Anthony RICHARD 8d2f02fe64 implémentation de la classe AbsGateway
2 years ago
Anthony RICHARD 817425eae2 ajout fonction getroles() dans user gateway
2 years ago
Anthony RICHARD cee482018c ajout des roles dans user
2 years ago
Anthony RICHARD 211c4939b2 model admin
2 years ago
Anthony RICHARD d355bb6312 admin controller
2 years ago
Anthony RICHARD 09c3c722d6 rangement fichiers et namespaces
2 years ago
Lucie GOIGOUX 4ad27dbc3d Ajout du diagramme de classe
2 years ago
Patrick BRUGIERE 43b1fb314e ajout controller student
2 years ago
Patrick BRUGIERE 47bbf93221 travail sur le modele de student
2 years ago
Anthony RICHARD 4ec3b41975 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
2 years ago
Anthony RICHARD 39d517725e mdladmin pour connection tmp
2 years ago
Anthony RICHARD 093323099d fix user gateway
2 years ago
Patrick BRUGIERE 25103052c8 legere modification
2 years ago
Anthony RICHARD 210b9528b3 fonctions modify dans user gateway
2 years ago
Patrick BRUGIERE d0651bb794 mise de la classe student dans la branche php et début de travail sur le modèle de la classe Student
2 years ago
Anthony RICHARD 60875a626b MCD MLD 2
2 years ago
Anthony RICHARD 9bfbef26b8 MCD MLD
2 years ago
Anthony RICHARD 879f7bf0f8 try catch dans UserGateway.php
2 years ago
Anthony RICHARD 278e09c468 MERGE
2 years ago
Anthony RICHARD 85880b6c08 User Gateway
2 years ago
Anthony RICHARD e369db326b suppression des classes Student et Teacher (ce sont pas des classes métiers mais des controllers)
2 years ago
Anthony RICHARD 6ef11e5afa fix classe User
2 years ago
Patrick BRUGIERE 62de5a4c3a travail sur la gateway de vocabulaire pour la finir et réalisation de la gateway de group
2 years ago
Patrick BRUGIERE 80929a6cd1 mise en commentaire des tests (fais avec ma base de données, donc ne peut pas fonctionner pour tous le monde)
2 years ago
Patrick BRUGIERE 9f92881e3f modification sur le vocabulaire et sa gateway
2 years ago
Patrick BRUGIERE 4026ea5245 travail sur le vocabulaire et sa gateway
2 years ago
Anthony RICHARD 254c73148e classe user fix
2 years ago
Anthony RICHARD b1c6ee9ddd classe student fix
2 years ago
Anthony RICHARD d89de651b8 class UserGateway avec méthode findAllStudent + findByName + findBySurname
2 years ago
Anthony RICHARD 1d915a01c0 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
2 years ago
Anthony RICHARD e7a4dc2216 classe group
2 years ago
Patrick BRUGIERE 0b1f158f57 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
2 years ago
Patrick BRUGIERE b8503c0e8b ajout de vocabularygateway
2 years ago
Anthony RICHARD 6dd1b64787 classe connection avec fix PDO
2 years ago
Anthony RICHARD 2fa6219bf6 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
2 years ago
Anthony RICHARD 6ec8385927 config.php
2 years ago
Antoine JOURDAIN 21cc9542e7 MAJ gitignore
2 years ago
Antoine JOURDAIN 90203b750c MAJ pour composer
2 years ago
Patrick BRUGIERE 402c896999 modification des classes
2 years ago
Patrick BRUGIERE e26db7575b travail sur la classe teacher
2 years ago
Anthony RICHARD 3f5da2c43a Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
2 years ago
Anthony RICHARD f2f9a7fc35 script pour créer la db
2 years ago
Patrick BRUGIERE 66e7433c03 legere modif
2 years ago
Patrick BRUGIERE 12daafa857 test sur user
2 years ago
Patrick BRUGIERE b0d83e2d49 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
2 years ago
Patrick BRUGIERE ff37ad15c4 travail sur vocabulary
2 years ago
Lucie GOIGOUX 110f9ce172 suppression du fichier vocabulaire
2 years ago
Lucie GOIGOUX 483f168b46 modification User
2 years ago
Patrick BRUGIERE 1224684f8b ajout dans la classe vocabulary
2 years ago
Lucie GOIGOUX 0f68fda8de ajout classes Student et Teacher
2 years ago
Antoine JOURDAIN 4becb88509 MAJ Global V2
2 years ago
Antoine JOURDAIN 8643948bd2 MAJ Global
2 years ago
Anthony RICHARD 898870f8a1 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
2 years ago
Anthony RICHARD f8b04c7ab3 Classe connection + classe group
2 years ago
Anthony RICHARD e3e4a47226 Merge remote-tracking branch 'refs/remotes/origin/php' into php
2 years ago
Anthony RICHARD 65aaf9e137 desactivation cache twig
2 years ago
Léon Enault 7557132ee0 Merge branch 'php' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into php
2 years ago
Lucie GOIGOUX 039603a0a0 Ajout de la classe student
2 years ago
Léon Enault 00842ea8d8 Ajout de la classe vocabulary
2 years ago
Patrick BRUGIERE 3386bfcac5 ajout classe teacher
2 years ago
Patrick BRUGIERE 9a7ea4512f mauvais dossier
2 years ago
Antoine JOURDAIN f3855559b3 Suppression doublon
2 years ago
Patrick BRUGIERE 5e4d7b13ae ajout de la classe teacher
2 years ago
Antoine JOURDAIN e966a297d8 Merge MVC
2 years ago
Anthony RICHARD 8f5f8f9743 MVC Twig
2 years ago
Antoine JOURDAIN a7485e215a Merge branch 'master' into php
2 years ago
Antoine JOURDAIN 0fdb33d659 MAJ gitignore
2 years ago
Antoine JOURDAIN 57037b9e90 Merge branch 'master' into php
2 years ago
Antoine JOURDAIN 083c1325a5 MAJ gitignore
2 years ago
Antoine JOURDAIN ac220279bc Rendu du rapport
2 years ago
Antoine JOURDAIN 95fd3104a3 Création de la classe User
2 years ago
Antoine JOURDAIN 6da7c7b990 Création projet PHP
2 years ago
Antoine JOURDAIN 884c6e258f Rapport 2
2 years ago
Lucie GOIGOUX a6657a74e2 Rapport1
2 years ago
Antoine JOURDAIN 334cd8ed33 Ajout compte rendu
2 years ago
Antoine JOURDAIN 0e6ec2eda8 Initial commit
2 years ago

834
.gitignore vendored

@ -1,414 +1,3 @@
# Created by https://www.toptal.com/developers/gitignore/api/linux,macos,windows,visualstudio,visualstudiocode,composer,phpstorm,csharp
# Edit at https://www.toptal.com/developers/gitignore?templates=linux,macos,windows,visualstudio,visualstudiocode,composer,phpstorm,csharp
### Composer ###
composer.phar
/vendor/
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
### Csharp ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
### Linux ###
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
@ -421,17 +10,11 @@ FodyWeavers.xsd
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### macOS ###
# General
# macOS
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
@ -450,361 +33,40 @@ Network Trash Folder
Temporary Items
.apdisk
### macOS Patch ###
# iCloud generated files
*.icloud
### PhpStorm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### PhpStorm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/
# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml
# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/
# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$
# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml
# Azure Toolkit for IntelliJ plugin
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
.idea/**/azureSettings.xml
# JetBrains
.idea/
### VisualStudioCode ###
!.vscode/*.code-snippets
# VisualStudioCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
### Windows ###
# Windows thumbnail cache files
# Windows
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
# Windows shortcuts
*.lnk
### VisualStudio ###
# User-specific files
# User-specific files (MonoDevelop/Xamarin Studio)
# Mono auto generated files
# Build results
# Visual Studio 2015/2017 cache/options directory
# Uncomment if you have tasks that create the project's static files in wwwroot
# Visual Studio 2017 auto generated files
# MSTest test Results
# NUnit
# Build Results of an ATL Project
# Benchmark Results
# .NET Core
# ASP.NET Scaffolding
# StyleCop
# Files built by Visual Studio
# Chutzpah Test files
# Visual C++ cache files
# Visual Studio profiler
# Visual Studio Trace Files
# TFS 2012 Local Workspace
# Guidance Automation Toolkit
# ReSharper is a .NET coding add-in
# TeamCity is a build add-in
# DotCover is a Code Coverage Tool
# AxoCover is a Code Coverage Tool
# Coverlet is a free, cross platform Code Coverage Tool
# Visual Studio code coverage results
# NCrunch
# MightyMoose
# Web workbench (sass)
# Installshield output folder
# DocProject is a documentation generator add-in
# Click-Once directory
# Publish Web Output
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
# NuGet Packages
# NuGet Symbol Packages
# The packages folder can be ignored because of Package Restore
# except build/, which is used as an MSBuild target.
# Uncomment if necessary however generally it will be regenerated when needed
# NuGet v3's project.json files produces more ignorable files
# Microsoft Azure Build Output
# Microsoft Azure Emulator
# Windows Store app package directories and files
# Visual Studio cache files
# files ending in .cache can be ignored
# but keep track of directories ending in .cache
# Others
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
# RIA/Silverlight projects
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
# SQL Server files
# Business Intelligence projects
# Microsoft Fakes
# GhostDoc plugin setting file
# Node.js Tools for Visual Studio
# Visual Studio 6 build log
# Visual Studio 6 workspace options file
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
# Visual Studio 6 technical files
# Visual Studio LightSwitch build output
# Paket dependency manager
# FAKE - F# Make
# CodeRush personal settings
# Python Tools for Visual Studio (PTVS)
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
# Telerik's JustMock configuration file
# BizTalk build output
# OpenCover UI analysis results
# Azure Stream Analytics local run output
# MSBuild Binary and Structured Log
# NVidia Nsight GPU debugger configuration file
# MFractors (Xamarin productivity tool) working folder
# Local History for Visual Studio
# Visual Studio History (VSHistory) files
# BeatPulse healthcheck temp database
# Backup folder for Package Reference Convert tool in Visual Studio 2017
# Ionide (cross platform F# VS Code tools) working folder
# Fody - auto-generated XML schema
# VS Code files for those working on multiple tools
# Local History for Visual Studio Code
# Windows Installer files from build outputs
# JetBrains Rider
### VisualStudio Patch ###
# Additional files built by Visual Studio
# End of https://www.toptal.com/developers/gitignore/api/linux,macos,windows,visualstudio,visualstudiocode,composer,phpstorm,csharp
# Created by https://www.toptal.com/developers/gitignore/api/intellij
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij
### Intellij ###
# Intellij
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
@ -812,93 +74,31 @@ $RECYCLE.BIN/
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/
# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml
# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/
# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$
# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml
# Azure Toolkit for IntelliJ plugin
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
.idea/**/azureSettings.xml
.idea/
# End of https://www.toptal.com/developers/gitignore/api/intellij
/.vs
/Project/adminBlazor/.vs
/Project/EntityFramework/**/bin/
/Project/EntityFramework/**/obj/

Binary file not shown.

@ -0,0 +1,319 @@
```plantuml
@startuml IEP
allowmixing
skinparam classAttributeIconSize 9
skinparam classBackgroundColor #123123
skinparam classBorderColor #fff
skinparam classArrowColor #123123
skinparam classFontColor #white
skinparam classFontName arial
skinparam BackgroundColor #white
namespace Model #lightgrey {
Class VocabularyList {
- id : int
- name : string
- image : string
- aut : int
+ VocabularyList(id : int, name : string, image : string, aut : sint)
+ getId() : int
+ getName() : string
+ getImage() : string
+ getAut() : int
}
Class User {
- id : int
- password : string
- email : string
- name : string
- surname : string
- nickname : string
- image : string
- extraTime : bool
- roles : array
- group : int
+ User(id : int, password : string, email : string, name : string, surname : string, nickname : string, image : string, extratime : bool, roles : array, group : int)
+ getId() : int
+ getPassword() : string
+ getEmail() : string
+ getName() : string
+ getSurname() : string
+ getNickname() : string
+ getImage() : string
+ isExtratime() : bool
+ getRoles() : array
+ getGroup() : int
}
Class Translation {
- id : int
- word1 : string
- word2 : string
- listVocab : int
+ Translation(id : int, word1 : string, word2 : string, listVocab : int)
+ getId() : int
+ getWord1() : string
+ getWord2() : string
+ getListVocab() : int
}
Class Group {
- id : string
- num : int
- year : int
- sector : string
+ Group(id : int, num : int, year : int, sector : string)
+ getId() : int
+ getNum() : int
+ getYear() : int
+ getSector() : string
}
Abstract Class AbsModel {
+ connection(login : string, password : string) : void
+ deconnection() : void
+ checkLoginExist(login : string)
+ {abstract} is(login : string, roles : array) : User
}
Class MdlAdmin {
+ getAllStudents() : array
+ getAllUsers() : array
+ getAllAdmins(): array
+ getAllTeachers() : array
+ getAllGroups() : array
+ getUnassignedUsers() : array
+ getUsersOfGroup(id : int) : array
+ removeUser(id : int) : void
+ addUserToGroup(user : int, group : int) : void
+ removeUserFromGroup(id : int) : void
+ addGroup(num : int, year : int, sector : string) : int
+ removeGroup(id : int) : void
+ is(login : string, roles : array) : User
}
Class MdlStudent {
+ getAll() : array
+ getVocabByName(name : string) : array
+ is(login : string, roles : array) : User
}
Class MdlTeacher {
+ getAll() : array
+ getAllGroups() : array
+ getAllStudent() : array
+ getVocabByName(name : string) : array
+ findByUser(id : int) : array
+ findGroupVocab(vocab : int) : array
+ findGroupNoVocab(vocab : int) : array
+ findByIdVoc(id : int) : array
+ addVocabToGroup(vocabID : int, groupID : int) : void
+ removeVocabFromGroup(vocabID : int, groupID : int) : void
+ addVocabList(userID : int, name : string, image : string, words : array) : void
+ removeVocById(id : int) : void
+ is(login : string, roles : array) : User
}
Class MdlUser {
+ modifyNickname(id : int, newNickname : string) : void
+ modifyPassword(id : int, newPassword : string) : void
+ getUserById(id : int) : User
+ is(login : string, roles : array) : User
}
MdlAdmin ---|> MdlUser
MdlStudent --|> MdlUser
MdlTeacher --|> MdlUser
MdlUser --|> AbsModel
MdlAdmin .u..> Gateway.GroupGateway
MdlAdmin .u..> Gateway.UserGateway
MdlStudent .do..> Gateway.UserGateway
MdlStudent .do..> Gateway.VocabularyListGateway
MdlTeacher .left.> Gateway.UserGateway
MdlTeacher .left> Gateway.GroupGateway
MdlTeacher .left> Gateway.TranslationGateway
MdlTeacher .left> Gateway.VocabularyListGateway
}
namespace Gateway #lightgrey {
abstract Class AbsGateway {
+ AbsGateway()
+ {abstract} add(parameters: array) : int
+ {abstract} remove(id: int) : void
+ {abstract} findAll() : array
+ {abstract} findById(id: int)
}
Class UserGateway {
- getRoles(id : int) : array
+ UserGateway()
+ add(parameters: array) : int
+ remove(id: int) : void
+ findAll() : array
+ findById(id: int) : User
+ findAllAdmins() : array
+ findAllTeachers() : array
+ findAllStudents() : array
+ findUserByEmail(email : string) : User
+ findUserByName(name : string) : array
+ findUserBySurname(surname : string) : array
+ findUserByNickname(nickname : string) : array
+ findUsersByGroup(id : int) : array
+ findUnassignedUsers() : array
+ login(login : string) : string
+ modifyPassword(id : int, newPassword : string) : void
+ modifyNickname(id : int, nickname : string) : void
+ modifyImage(id : int, image : string) : void
+ modifyGroup(id : int, newGroup : int) : void
}
class GroupGateway {
+ GroupGateway()
+ add(parameters: array) : int
+ remove(id: int) : void
+ findAll() : array
+ findById(id: int) : Group
+ findByNum (num: string): array
+ findGroupVocab(vocab : int) : array
+ findGroupNoVocab(vocab : int) : array
+ addVocabToGroup(vocab : int, group : int) : void
+ removeVocabFromGroup(vocab : int, group : int) : void
+ modifyGroupById (id: int, num: int, year: int, sector: string): void
}
class TranslationGateway {
- addWord(word: string): void
+ TranslationGateway()
+ add(parameters: array) : int
+ remove(id: int) : void
+ findAll() : array
+ findById(id: int) : Translation
+ findByIdVoc(id: int): array
}
Class VocabularyListGateway {
+ VocabularyListGateway()
+ add(parameters: array) : int
+ remove(id: int) : void
+ findAll() : array
+ findById(id: int) : VocabularyList
+ findByName(name : string) : array
+ findByGroup(id : int) : array
+ findByUser(id : int) : array
+ findByName(name: string): array
+ findByGroup(id: int): array
+ modifVocabListById(id : int, name : string, img : string, aut : string) : void
}
UserGateway -|> AbsGateway
GroupGateway --|> AbsGateway
TranslationGateway ---|> AbsGateway
VocabularyListGateway ---|> AbsGateway
AbsGateway *--- Config.Connection : #con : Connection
UserGateway ..> Model.User
GroupGateway ..> Model.Group
TranslationGateway ..> Model.Translation
VocabularyListGateway ..> Model.VocabularyList
}
namespace Controller #lightgrey {
class VisitorController {
+ login() : void
+ confirmLogin() : void
+ disconnect() : void
+ checkLoginExist(login : string) : bool
+ memory(match : array) : void
+ quiz(match : array) : void
+ resultatsJeux(match : array) : void
}
class UserController {
+ showAccountInfos() : void
+ modifyPassword() : void
+ modifyNickname() : void
+ {static} home() : void
}
Class AdminController{
+ showAllUsers() : void
+ showAllAdmins() : void
+ showAllTeachers() : void
+ showAllStudents() : void
+ showAllGroups() : void
+ removeUser() : void
+ showGroupDetails() : void
+ removeUserFromGroup() : void
+ removeGroup() : void
+ addGroup() : void
+ addUserToGroup() : void
}
Class StudentController{
+ ListVocChoice() : void
+ gameChoice() : void
+ getByName() : void
}
Class TeacherController{
+ affAllStudent() : void
+ affAllVocab() : void
+ getByName() : void
+ DelById() : void
+ getContent() : void
+ addVocabToGroup() : void
+ removeVocabFromGroup() : void
+ showVocabListForm() : void
+ addVocabList() : void
}
Class FrontController {
+ FrontController()
}
AdminController --|> UserController
TeacherController -left|> UserController
StudentController --|> UserController
UserController --|> VisitorController
VisitorController ..> Config.Validation
FrontController ..> VisitorController
FrontController ..> UserController
FrontController ..> Config.Validation
FrontController ..> Model.MdlUser
StudentController ..> Model.MdlStudent
TeacherController ..> Model.MdlTeacher
AdminController ..> Model.MdlAdmin
}
namespace Config #lightgray{
Class Connection {
- stmt
+ executeQuery(query : string, parameters : array) : bool
+ getResult() : array
}
Class Validation{
+ {static} val_action(action) : string
+ {static} val_password(value) : string
+ {static} filter_int(value) : int
+ {static} filter_str_simple(value) : string
+ {static} filter_str_nospecialchar(value) : string
}
}
@enduml

Binary file not shown.

Binary file not shown.

@ -0,0 +1,152 @@
```plantuml
@startuml
left to right direction
skinparam usecase {
BackgroundColor lightGreen
BorderColor DarkSlateGray
ArrowColor darkgreen
}
actor User as User
actor Admin as Admin
actor Teacher as Teacher
actor Student as Student
actor Visitor as Visitor
User <|--- Admin
User <|---- Teacher
User <|-- Student
Visitor <|- User
note left of (User)
The user must
be connected
end note
package App {
usecase "Add a group" as ES1.1
usecase "Delete a group" as ES1.2
usecase "Import students automatically \n from an Excel doc" as ES1.3
usecase "Show the groups" as ES1.4
usecase "Delete a user" as ES1.5
usecase "Show the users list" as ES1.6
usecase "Give a role" as ES1.7
usecase "Add a student in a group" as ES1.9
usecase "Delete a student in a group" as ES1.10
usecase "Ban a user" as ES1.11
usecase "Choose if a quiz is \n accessible only to a particular group \n or open to all, to each group" as ES1.13
usecase "Share my quiz with other teachers" as ES1.14
usecase "Listen to the words to also \n work my listening comprehension" as ES1.15
usecase "Create an interactive quiz during a course" as ES2.1
usecase "Know my overall progress since I installed the app" as ES2.4
usecase "Consult the translation and the meaning \n of certain words in an online dictionary" as ES2.5
usecase "Create my own flash card to train myself" as ES2.7
usecase "Know my progress on a quiz" as ES2.8
usecase "View student results who \n participate in my quizzes at all moment" as ES2.9
usecase "Create a quiz for students training" as ES3.1
usecase "Download quizzes to do them \n later without an internet connection" as ES3.3
usecase "Join a quizz with a code" as ES3.4
usecase "Have access to the vocabulary \n list with a link" as ES3.6
usecase "Evaluate students from anywhere" as ES4.1
usecase "Receive an email to notify \n me when Im about to have an exam " as ES4.2
usecase "Change the level of my \n trainings games/quizzes" as ES4.3
usecase "Choose if I want to work \n from English to French or vice \nversa in the tests" as ES4.4
usecase "Choose a strict difficulty mode (0 error) \n or tolerant (1 or 2 errors) for my exams" as ES4.5
usecase "Easily switch from dark \n theme to theme clear and vice versa \n when Im on the application (web or mobile)" as ES5.1
usecase "Change the speed of scrolling \n flashcard when I use scroll mode automatic" as ES5.3
usecase "Change my password" as ES5.6
usecase "Receive a message encouraging the end \n of my test to motivate me to continue" as ES5.8
usecase "Show my rank on quizzes" as ES5.10
usecase "Play a game in a demo to test the app" as ES6.1
usecase "Play a game" as ES6.2
usecase "Choose a game" as ES6.3
usecase "Choose the vocabulary list" as ES6.4
usecase "Give feedback after a quiz" as ES6.5
usecase "Sign in" as ES6.6
usecase "List quizzes/Vocabulary" as ES6.7
usecase "Delete a quiz" as ES6.8
usecase "Change nickname" as ES6.9
}
Admin --> ES1.1
Admin --> ES1.3
Admin --> ES1.4
Admin ----> ES1.6
Student --> ES1.15
Teacher -> ES2.1
Student --> ES2.4
Student --> ES2.5
Student --> ES2.7
ES6.2 <.. ES2.8 : include
Student --> ES3.3
Student --> ES3.4
ES3.1 ..> ES3.6 : extends
ES2.1 ..> ES3.6 : extends
Teacher ---> ES4.1
Student --> ES4.2
ES4.1 ..> ES4.5 : include
ES3.1 ..> ES1.13 : include
ES3.1 ..> ES1.14 : extends
Teacher --> ES3.1
ES6.3 ..> ES4.3 : extends
ES6.3 ..> ES4.4 : include
ES4.1 ..> ES2.9 : extends
Visitor --> ES5.1
User --> ES5.3
User --> ES5.6
ES3.4 <.. ES5.10 : include
ES6.2 <.. ES5.8 : include
Visitor --> ES6.1
Student --> ES6.2
Visitor --> ES6.6
Teacher --> ES6.7
User --> ES6.9
ES6.2 ..> ES6.3 : include
ES6.3 ..> ES6.4 : include
ES6.2 <.. ES6.5 : include
ES6.7 ..> ES6.8 : extends
ES1.6 ..> ES1.7 : extends
ES1.6 ..> ES1.5 : extends
ES1.6 ..> ES1.11 : extends
ES1.4 ..> ES1.2 : extends
ES1.4 ..> ES1.9 : extends
ES1.4 ..> ES1.10 : extends
ES1.6 ..> ES1.9 : extends
@enduml

@ -0,0 +1,30 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
!**/.gitignore
!.git/HEAD
!.git/config
!.git/packed-refs
!.git/refs/heads/**

@ -0,0 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<StartWorkingDirectory>$(MSBuildProjectDirectory)</StartWorkingDirectory>
<UserSecretsId>1540d456-1696-425e-b511-611542ce7c5e</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DTOToEntity\DTOToEntity.csproj" />
<ProjectReference Include="..\DTO\DTO.csproj" />
<ProjectReference Include="..\Entities\Entities.csproj" />
<ProjectReference Include="..\StubbedContext\StubbedContextLib.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ActiveDebugProfile>https</ActiveDebugProfile>
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

@ -0,0 +1,6 @@
@API_HostAddress = http://localhost:5124
GET {{API_HostAddress}}/weatherforecast/
Accept: application/json
###

@ -0,0 +1,44 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.IdentityModel.Tokens;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
namespace API.Controllers
{
[ApiController]
[Route("[controller]")]
public class AuthController : ControllerBase
{
private readonly IConfiguration _configuration;
public AuthController(IConfiguration configuration)
{
_configuration = configuration;
}
[HttpPost]
[Route("token")]
public IActionResult GetToken()
{
var tokenHandler = new JwtSecurityTokenHandler();
var key = Encoding.ASCII.GetBytes(_configuration["JwtTokenSettings:SymmetricSecurityKey"]);
var tokenDescriptor = new SecurityTokenDescriptor
{
Subject = new ClaimsIdentity(new Claim[]
{
new Claim(ClaimTypes.Name, "User1"),
}),
Expires = DateTime.UtcNow.AddHours(1),
SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature),
Audience = _configuration["JwtTokenSettings:ValidAudience"],
Issuer = _configuration["JwtTokenSettings:ValidIssuer"]
};
var token = tokenHandler.CreateToken(tokenDescriptor);
var tokenString = tokenHandler.WriteToken(token);
return Ok(new { Token = tokenString });
}
}
}

@ -0,0 +1,225 @@
using DTO;
using DTOToEntity;
using Entities;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using StubbedContextLib;
namespace API.Controllers
{
[Authorize]
[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
[ApiVersion("1.0")]
public class GroupController : ControllerBase
{
private readonly IGroupService _service;
private readonly ILogger<GroupController> _logger;
public GroupController(IGroupService groupService, ILogger<GroupController> logger)
{
_service = groupService;
_logger = logger;
}
[HttpGet]
public async Task<ActionResult<PageResponse<GroupDTO>>> GetGroups(int index, int count)
{
try
{
_logger.LogInformation("Getting groups ");
var groups = await _service.Gets(index, count);
return groups;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération des groupes.");
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpGet("{id}")]
public async Task<ActionResult<GroupDTO>> GetGroup(long id)
{
try
{
_logger.LogInformation("Getting a group with id {id}", id);
var group = await _service.GetById(id);
if (group == null)
{
return NotFound();
}
return group;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération du groupe avec l'ID {id}.", id);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpPut]
public async Task<ActionResult<GroupDTO>> UpdateGroup([FromBody]GroupDTO group)
{
try
{
_logger.LogInformation("Updating a group with id : {id}", group.Id);
var updatedGroup = await _service.Update(group);
return updatedGroup;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la mise à jour du groupe avec l'ID {id}.", group.Id);
// Retourner une réponse d'erreur
return StatusCode(400,ex.Message);
}
}
[HttpPost]
public async Task<ActionResult<GroupDTO>> AddGroup([FromBody]GroupDTO group)
{
try
{
_logger.LogInformation("Adding a group with id : {id}", group.Id);
group.Id = _service.Gets(0, 0).Result.TotalCount + 1;
var newGroup = await _service.Add(group);
return newGroup;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de l'ajout du groupe avec l'ID {id}.", group.Id);
// Retourner une réponse d'erreur
return StatusCode(400,ex.Message);
}
}
[HttpDelete("{id}")]
public async Task<ActionResult<GroupDTO>> DeleteGroup(long id)
{
try
{
_logger.LogInformation("Deleting a group with id : {id}", id);
var group = await _service.Delete(id);
return group;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la suppression du groupe avec l'ID {id}.", id);
// Retourner une réponse d'erreur
return StatusCode(400,ex.Message);
}
}
[HttpGet("num/{num}")]
public async Task<ActionResult<PageResponse<GroupDTO>>> GetGroupsByNum(int index, int count, int num)
{
try
{
_logger.LogInformation("Getting groups by num : {num}", num);
var groups = await _service.GetByNum(index, count, num);
return groups;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération des groupes avec le numéro {num}.", num);
// Retourner une réponse d'erreur
return StatusCode(400,ex.Message);
}
}
[HttpGet("sector/{sector}")]
public async Task<ActionResult<PageResponse<GroupDTO>>> GetGroupsBySector(int index, int count, string sector)
{
try
{
_logger.LogInformation("Getting groups by sector : {sector}", sector);
var groups = await _service.GetBySector(index, count, sector);
return groups;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération des groupes avec le secteur {sector}.", sector);
// Retourner une réponse d'erreur
return StatusCode(400,ex.Message);
}
}
[HttpGet("year/{year}")]
public async Task<ActionResult<PageResponse<GroupDTO>>> GetGroupsByYear(int index, int count, int year)
{
try
{
_logger.LogInformation("Getting groups by year : {year}", year);
var groups = await _service.GetByYear(index, count, year);
return groups;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération des groupes avec l'année {year}.", year);
// Retourner une réponse d'erreur
return StatusCode(400,ex.Message);
}
}
[HttpPost("addUser")]
public async Task<ActionResult<UserDTO>> AddUserToGroup([FromBody]long userId, long groupId)
{
try
{
_logger.LogInformation("Adding user with id : {userId} to group with id : {groupId}", userId, groupId);
var user = await _service.AddUserToGroup(userId, groupId);
return user;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de l'ajout de l'utilisateur avec l'ID {userId} au groupe avec l'ID {groupId}.", userId, groupId);
// Retourner une réponse d'erreur
return StatusCode(400,ex.Message);
}
}
[HttpPost("addVocabularyList")]
public async Task<ActionResult<VocabularyListDTO>> AddVocabularyListToGroup([FromQuery]long vocabularyListId, long groupId)
{
try
{
_logger.LogInformation("Adding vocabulary list with id : {vocabularyListId} to group with id : {groupId}", vocabularyListId, groupId);
var vocabularyList = await _service.AddVocabularyListToGroup(vocabularyListId, groupId);
return vocabularyList;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de l'ajout de la liste de vocabulaire avec l'ID {vocabularyListId} au groupe avec l'ID {groupId}.", vocabularyListId, groupId);
// Retourner une réponse d'erreur
return StatusCode(400,ex.Message);
}
}
}
}

@ -0,0 +1,120 @@
using DTO;
using DTOToEntity;
using Entities;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using StubbedContextLib;
namespace API.Controllers
{
[Authorize]
[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
[ApiVersion("1.0")]
public class LangueController : ControllerBase
{
private readonly IService<LangueDTO> _service;
private readonly ILogger<LangueController> _logger;
public LangueController(IService<LangueDTO> LangueService, ILogger<LangueController> logger)
{
_service = LangueService;
_logger = logger;
}
[HttpGet]
public async Task<ActionResult<PageResponse<LangueDTO>>> GetLangues(int index, int count)
{
try {
_logger.LogInformation("Getting langues ");
var groups = await _service.Gets(index,count);
return groups;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération des langues.");
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpGet("{name}")]
public async Task<ActionResult<LangueDTO>> GetLangue(string name)
{
try {
_logger.LogInformation("Getting a langue with name {name}",name);
var group = await _service.GetById(name);
return group;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération de la langue avec le nom {name}.", name);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
//On ne peut pas changer la langue car son nom est son Id
/*
[HttpPut]
public async Task<ActionResult<LangueDTO>> UpdateLangue([FromQuery]LangueDTO langue)
{
try
{
_logger.LogInformation("Updating a langue with name : {name}", langue.name);
var updatedGroup = await _service.Update(langue);
return updatedGroup;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la mise à jour de la langue avec le nom {name}.", langue.name);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}*/
[HttpPost]
public async Task<ActionResult<LangueDTO>> AddLangue([FromQuery]LangueDTO langue)
{
try
{
_logger.LogInformation("Adding a langue with name : {name}", langue.name);
var newGroup = await _service.Add(langue);
return newGroup;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de l'ajout de la langue avec le nom {name}.", langue.name);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpDelete("{name}")]
public async Task<ActionResult<LangueDTO>> DeleteLangue(string name)
{
try
{
_logger.LogInformation("Deleting a langue with name : {name}", name);
var group = await _service.Delete(name);
return group;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la suppression de la langue avec le nom {name}.", name);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
}
}

@ -0,0 +1,100 @@

using DTO;
using DTOToEntity;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace API.Controllers
{
[Authorize]
[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
[ApiVersion("1.0")]
public class RoleController : ControllerBase
{
private readonly IService<RoleDTO> _service;
private readonly ILogger<RoleController> _logger;
public RoleController(IService<RoleDTO> RoleService, ILogger<RoleController> logger)
{
_service = RoleService;
_logger = logger;
}
[HttpGet]
public async Task<ActionResult<PageResponse<RoleDTO>>> GetRoles(int index, int count)
{
try
{
_logger.LogInformation("Getting Roles ");
var groups = await _service.Gets(index, count);
return groups;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération des roles.");
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpGet("{id}")]
public async Task<ActionResult<RoleDTO>> GetRole(long id)
{
try
{
_logger.LogInformation("Getting a role with id {id}", id);
var group = await _service.GetById(id);
return group;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération du role avec l'ID {id}.", id);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpPost]
public async Task<ActionResult<RoleDTO>> AddRole([FromQuery] RoleDTO role)
{
try
{
_logger.LogInformation("Adding a role with id : {id}", role.Id);
role.Id = _service.Gets(0, 0).Result.TotalCount + 1;
var newGroup = await _service.Add(role);
return newGroup;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de l'ajout du role avec l'ID {id}.", role.Id);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpDelete("{id}")]
public async Task<ActionResult<RoleDTO>> DeleteRole(long id)
{
try {
_logger.LogInformation("Deleting a role with id : {id}", id);
var group = await _service.Delete(id);
return group;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la suppression du role avec l'ID {id}.", id);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
}
}

@ -0,0 +1,135 @@

using DTO;
using DTOToEntity;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace API.Controllers
{
[Authorize]
[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
[ApiVersion("1.0")]
public class TranslateController : ControllerBase
{
private readonly ITranslateService _service;
private readonly ILogger<TranslateController> _logger;
public TranslateController(ITranslateService TranslateService, ILogger<TranslateController> logger)
{
_service = TranslateService;
_logger = logger;
}
[HttpGet]
public async Task<ActionResult<PageResponse<TranslateDTO>>> GetTranslates(int index, int count)
{
try
{
_logger.LogInformation("Getting Translates ");
var Translates = await _service.Gets(index, count);
return Translates;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération des Translates.");
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpGet("{id}")]
public async Task<ActionResult<TranslateDTO>> GetTranslate(long id)
{
try {
_logger.LogInformation("Getting a Translate with id {id}", id);
var Translate = await _service.GetById(id);
return Translate;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération du Translate avec l'ID {id}.", id);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpPut]
public async Task<ActionResult<TranslateDTO>> UpdateTranslate([FromQuery] TranslateDTO Translate)
{
try {
_logger.LogInformation("Updating a Translate with id : {id}", Translate.Id);
var updatedTranslate = await _service.Update(Translate);
return updatedTranslate;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la mise à jour du Translate avec l'ID {id}.", Translate.Id);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpDelete("{id}")]
public async Task<ActionResult<TranslateDTO>> DeleteTranslate(long id)
{
try {
_logger.LogInformation("Deleting a Translate with id : {id}", id);
var Translate = await _service.Delete(id);
return Translate;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la suppression du Translate avec l'ID {id}.", id);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpPost]
public async Task<ActionResult<TranslateDTO>> AddTranslate([FromBody] TranslateDTO Translate)
{
try {
_logger.LogInformation("Adding a Translate with id : {id}", Translate.Id);
Translate.Id = _service.Gets(0,0).Result.TotalCount + 1;
var newTranslate = await _service.Add(Translate);
return newTranslate;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de l'ajout du Translate avec l'ID {id}.", Translate.Id);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpPost("AddVocab")]
public async Task<ActionResult<VocabularyDTO>> AddVocab([FromQuery] string vocabId, long translateId)
{
try
{
_logger.LogInformation("Adding a Vocabulary to a Translate with id : {id}", translateId);
var newVocab = await _service.AddVocabToTranslate(vocabId, translateId);
return newVocab;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de l'ajout du Vocabulary au Translate avec l'ID {id}.", translateId);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
}
}

@ -0,0 +1,159 @@

using DTO;
using DTOToEntity;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace API.Controllers
{
[Authorize]
[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
[ApiVersion("1.0")]
public class UserController : ControllerBase
{
private readonly IUserService _service;
private readonly ILogger<UserController> _logger;
public UserController(IUserService userService, ILogger<UserController> logger)
{
_service = userService;
_logger = logger;
}
[HttpGet]
public async Task<ActionResult<PageResponse<UserDTO>>> GetUsers(int index,int count)
{
try
{
_logger.LogInformation("Getting Users ");
var users = await _service.Gets(index, count);
return users;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération des utilisateurs.");
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpPost]
public async Task<ActionResult<UserDTO>> AddUser([FromQuery] UserDTO user)
{
try
{
_logger.LogInformation("Adding a user with id : {id}", user.Id);
user.Id = _service.Gets(0, 0).Result.TotalCount + 1;
var newUser = await _service.Add(user);
return newUser;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de l'ajout de l'utilisateur avec l'ID {id}.", user.Id);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpDelete("{id}")]
public async Task<ActionResult<UserDTO>> DeleteUser(long id)
{
try
{
_logger.LogInformation("Deleting a user with id : {id}", id);
var user = await _service.Delete(id);
return user;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la suppression de l'utilisateur avec l'ID {id}.", id);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpPut]
public async Task<ActionResult<UserDTO>> UpdateUser([FromQuery] UserDTO user)
{
try
{
_logger.LogInformation("Updating a user with id : {id}", user.Id);
var updatedUser = await _service.Update(user);
return updatedUser;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la mise à jour de l'utilisateur avec l'ID {id}.", user.Id);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpGet("{id}")]
public async Task<ActionResult<UserDTO>> GetUser(long id)
{
try
{
_logger.LogInformation("Getting a user with id {id}", id);
var user = await _service.GetById(id);
return user;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération de l'utilisateur avec l'ID {id}.", id);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpGet("group/{group}")]
public async Task<ActionResult<PageResponse<UserDTO>>> GetUsersByGroup(int index, int count, int group)
{
try
{
_logger.LogInformation("Getting Users by group");
var users = await _service.GetByGroup(index, count, group);
return users;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération des utilisateurs par groupe.");
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpGet("role/{role}")]
public async Task<ActionResult<PageResponse<UserDTO>>> GetUsersByRole(int index, int count, string role)
{
try
{
_logger.LogInformation("Getting Users by role");
var users = await _service.GetByRole(index, count, role);
return users;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération des utilisateurs par rôle.");
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
}
}

@ -0,0 +1,160 @@

using DTO;
using DTOToEntity;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace API.Controllers
{
[Authorize]
[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
[ApiVersion("1.0")]
public class VocabularyController : ControllerBase
{
private readonly IVocabularyService _service;
private readonly ILogger<VocabularyController> _logger;
public VocabularyController(IVocabularyService vocService, ILogger<VocabularyController> logger)
{
_service = vocService;
_logger = logger;
}
[HttpGet]
public async Task<ActionResult<PageResponse<VocabularyDTO>>> GetVocabularies(int index, int count)
{
try
{
_logger.LogInformation("Getting vocabularies ");
var vocabularies = await _service.Gets(index, count);
return vocabularies;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération des vocabulaires.");
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpGet("{word}")]
public async Task<ActionResult<VocabularyDTO>> GetVocabulary(string word)
{
try
{
_logger.LogInformation("Getting a vocabulary with id {id}", word);
var vocabulary = await _service.GetById(word);
return vocabulary;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération du vocabulaire avec l'ID {word}.", word);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpPut]
public async Task<ActionResult<VocabularyDTO>> UpdateVocabulary([FromQuery] VocabularyDTO vocabulary)
{
try
{
_logger.LogInformation("Updating a vocabulary with word : {word}", vocabulary.word);
var updatedVocabulary = await _service.Update(vocabulary);
return updatedVocabulary;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la mise à jour du vocabulaire avec l'ID {word}.", vocabulary.word);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpDelete("{word}")]
public async Task<ActionResult<VocabularyDTO>> DeleteVocabulary(string word)
{
try
{
_logger.LogInformation("Deleting a vocabulary with word : {word}", word);
var vocabulary = await _service.Delete(word);
return vocabulary;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la suppression du vocabulaire avec l'ID {word}.", word);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpPost]
public async Task<ActionResult<VocabularyDTO>> AddVocabulary([FromQuery] VocabularyDTO vocabulary)
{
try
{
_logger.LogInformation("Adding a vocabulary with word : {word}", vocabulary.word);
var newVocabulary = await _service.Add(vocabulary);
return newVocabulary;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de l'ajout du vocabulaire avec l'ID {word}.", vocabulary.word);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpGet("langue/{langue}")]
public async Task<ActionResult<PageResponse<VocabularyDTO>>> GetByLangue(string langue, int index, int count)
{
try
{
_logger.LogInformation("Getting vocabularies by langue {langue}",langue);
var vocabularies = await _service.GetByLangue(index, count, langue);
return vocabularies;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération des vocabulaires par langue {langue}.",langue);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpPost("AddTranslation")]
public async Task<ActionResult<TranslateDTO>> AddTranslation([FromQuery] string vocId, long translationId)
{
try
{
_logger.LogInformation("Adding a translation with id : {id}", vocId);
var newVocabulary = await _service.AddTranslationToVocabulary(vocId, translationId);
return newVocabulary;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de l'ajout de la traduction avec l'ID {id}.", vocId);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
}
}

@ -0,0 +1,160 @@

using DTO;
using DTOToEntity;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace API.Controllers
{
[Authorize]
[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
[ApiVersion("1.0")]
public class VocabularyListController : ControllerBase
{
private readonly IVocabularyListService _service;
private readonly ILogger<VocabularyListController> _logger;
public VocabularyListController(IVocabularyListService vocService, ILogger<VocabularyListController> logger)
{
_service = vocService;
_logger = logger;
}
[HttpGet]
public async Task<ActionResult<PageResponse<VocabularyListDTO>>> GetVocabularyLists(int index, int count)
{
try
{
_logger.LogInformation("Getting VocabularyLists ");
var VocabularyLists = await _service.Gets(index, count);
return VocabularyLists;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération des VocabularyLists.");
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpGet("{id}")]
public async Task<ActionResult<VocabularyListDTO>> GetVocabularyList(long id)
{
try
{
_logger.LogInformation("Getting a GroupVocabularyList with id {id}", id);
var VocabularyList = await _service.GetById(id);
return VocabularyList;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération du GroupVocabularyList avec l'ID {id}.", id);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpPut]
public async Task<ActionResult<VocabularyListDTO>> UpdateVocabularyList([FromQuery] VocabularyListDTO VocabularyList)
{
try
{
_logger.LogInformation("Updating a GroupVocabularyList with id : {id}", VocabularyList.Id);
var updatedVocabularyList = await _service.Update(VocabularyList);
return updatedVocabularyList;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la mise à jour du GroupVocabularyList avec l'ID {id}.", VocabularyList.Id);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpDelete("{id}")]
public async Task<ActionResult<VocabularyListDTO>> DeleteVocabularyList(long id)
{
try
{
_logger.LogInformation("Deleting a GroupVocabularyList with id : {id}", id);
var VocabularyList = await _service.Delete(id);
return VocabularyList;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la suppression du GroupVocabularyList avec l'ID {id}.", id);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpPost]
public async Task<ActionResult<VocabularyListDTO>> AddVocabularyList([FromQuery] VocabularyListDTO VocabularyList)
{
try
{
_logger.LogInformation("Adding a GroupVocabularyList with id : {id}", VocabularyList.Id);
VocabularyList.Id = _service.Gets(0, 0).Result.TotalCount + 1;
var newVocabularyList = await _service.Add(VocabularyList);
return newVocabularyList;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de l'ajout du GroupVocabularyList avec l'ID {id}.", VocabularyList.Id);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpGet("user/{user}")]
public async Task<ActionResult<PageResponse<VocabularyListDTO>>> GetVocabularyListsByUser(int index, int count, int user)
{
try
{
_logger.LogInformation("Getting VocabularyLists by user {user}", user);
var VocabularyLists = await _service.GetByUser(index, count, user);
return VocabularyLists;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de la récupération des VocabularyLists.");
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
[HttpPost("AddGroup")]
public async Task<ActionResult<GroupDTO>> AddGroupToVocabularyList([FromQuery]long groupId, long vocabId)
{
try
{
_logger.LogInformation("Adding a group to a VocabularyList with id : {id}", vocabId);
var group = await _service.AddGroupToVocabularyList(groupId, vocabId);
return group;
}
catch (Exception ex)
{
// Journaliser l'exception
_logger.LogError(ex, "Une erreur s'est produite lors de l'ajout du groupe à la VocabularyList avec l'ID {id}.", vocabId);
// Retourner une réponse d'erreur
return StatusCode(400, ex.Message);
}
}
}
}

@ -0,0 +1,30 @@
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["API/API.csproj", "API/"]
COPY ["DTOToEntity/DTOToEntity.csproj", "DTOToEntity/"]
COPY ["DbContext/DbContextLib.csproj", "DbContext/"]
COPY ["Entities/Entities.csproj", "Entities/"]
COPY ["DTO/DTO.csproj", "DTO/"]
COPY ["StubbedContext/StubbedContextLib.csproj", "StubbedContext/"]
RUN dotnet restore "./API/./API.csproj"
COPY . .
WORKDIR "/src/API"
RUN dotnet build "./API.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./API.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "API.dll"]

@ -0,0 +1,117 @@
using Microsoft.Extensions.Configuration;
using StubbedContextLib;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.SqlServer;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Entities;
using DTOToEntity;
using DTO;
using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.IdentityModel.Tokens;
using DbContextLib;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using System.Text;
using Microsoft.OpenApi.Models;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddDbContext<StubbedContext>(options =>
{
options.UseSqlServer(builder.Configuration.GetConnectionString("StubbedContext"));
});
builder.Services.AddSwaggerGen(option =>
{
option.SwaggerDoc("v1", new OpenApiInfo { Title = "Test API", Version = "v1" });
option.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
In = ParameterLocation.Header,
Description = "Please enter a valid token",
Name = "Authorization",
Type = SecuritySchemeType.Http,
BearerFormat = "JWT",
Scheme = "Bearer"
});
option.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type=ReferenceType.SecurityScheme,
Id="Bearer"
}
},
new string[]{}
}
});
});
var validIssuer = builder.Configuration.GetValue<string>("JwtTokenSettings:ValidIssuer");
var validAudience = builder.Configuration.GetValue<string>("JwtTokenSettings:ValidAudience");
var symmetricSecurityKey = builder.Configuration.GetValue<string>("JwtTokenSettings:SymmetricSecurityKey");
builder.Services.AddAuthentication(options => {
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
//options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer(options =>
{
options.IncludeErrorDetails = true;
options.TokenValidationParameters = new TokenValidationParameters()
{
ValidateIssuer = true,
ValidateAudience = true,
ValidateLifetime = true,
ValidateIssuerSigningKey = true,
ValidIssuer = validIssuer,
ValidAudience = validAudience,
IssuerSigningKey = new SymmetricSecurityKey(
Encoding.UTF8.GetBytes(symmetricSecurityKey)
),
};
});
builder.Services.AddApiVersioning(o =>
{
o.DefaultApiVersion = new ApiVersion(1, 1);
o.AssumeDefaultVersionWhenUnspecified = true;
o.ReportApiVersions = true;
});
builder.Services.AddScoped<IGroupService, GroupService>();
builder.Services.AddScoped<IService<LangueDTO>,LangueService>();
builder.Services.AddScoped<IService<RoleDTO>,RoleService>();
builder.Services.AddScoped<ITranslateService,TranslateService>();
builder.Services.AddScoped<IUserService, UserService>();
builder.Services.AddScoped<IVocabularyService, VocabularyService>();
builder.Services.AddScoped<IVocabularyListService, VocabularyListService>();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseAuthentication();
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();

@ -0,0 +1,52 @@
{
"profiles": {
"http": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "http://localhost:5124"
},
"https": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7013;http://localhost:5124"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
"environmentVariables": {
"ASPNETCORE_HTTPS_PORTS": "8081",
"ASPNETCORE_HTTP_PORTS": "8080"
},
"publishAllPorts": true,
"useSSL": true
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:32547",
"sslPort": 44345
}
}
}

@ -0,0 +1,13 @@
namespace API
{
public class WeatherForecast
{
public DateOnly Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string? Summary { get; set; }
}
}

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

@ -0,0 +1,15 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"JwtTokenSettings": {
"ValidIssuer": "ExampleIssuer",
"ValidAudience": "ValidAudience",
"SymmetricSecurityKey": "fvh8456477hth44j6wfds98bq9hp8bqh9ubq9gjig3qr0[94vj5",
"JwtRegisteredClaimNamesSub": "345h098bb8reberbwr4vvb8945"
},
"AllowedHosts": "*"
}

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -0,0 +1,15 @@
namespace DTO
{
public class GroupDTO
{
public long Id { get; set; }
public int Num { get; set; }
public int Year { get; set; }
public string sector { get; set; }
//public ICollection<UserDTO> Users { get; set; } = new List<UserDTO>();
//public ICollection<VocabularyListDTO> VocabularyList { get; set; } = new List<VocabularyListDTO>();
}
}

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTO
{
public class LangueDTO
{
public string
name { get; set; }
//public ICollection<VocabularyDTO> vocabularys { get; set; } = new List<VocabularyDTO>();
}
}

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTO
{
public class RoleDTO
{
public long Id { get; set; }
public string Name { get; set; }
//public ICollection<UserDTO> Users { get; set; } = new List<UserDTO>();
}
}

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTO
{
public class TranslateDTO
{
public long Id { get; set; }
[ForeignKey(nameof(WordsId))]
public string WordsId { get; set; }
//public ICollection<VocabularyDTO> Words { get; set; } = new List<VocabularyDTO>();
[ForeignKey(nameof(VocabularyListVocId))]
public long VocabularyListVocId { get; set; }
//public VocabularyListDTO VocabularyListVoc { get; set; } = null!;
}
}

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTO
{
public class UserDTO
{
public long Id { get; set; }
public string Password { get; set; }
public string Email { get; set; }
public string Name { get; set; }
public string UserName { get; set; }
public string NickName { get; set; }
public string? image { get; set; } = null;
public long GroupId { get; set; }
//public GroupDTO? Group { get; set; } = null;
public long RoleId { get; set; }
//public RoleDTO? Role { get; set; } = null!;
public Boolean ExtraTime { get; set; }
//public ICollection<VocabularyListDTO> VocabularyList { get; set; } = new List<VocabularyListDTO>();
}
}

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTO
{
public class VocabularyDTO
{
public string word { get; set; }
//public ICollection<TranslateDTO> translations { get; set; } = new List<TranslateDTO>();
public string LangueName { get; set; }
//public LangueDTO? Langue { get; set; } = null!;
}
}

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTO
{
public class VocabularyListDTO
{
public long Id { get; set; }
public string Name { get; set; }
public string Image { get; set; }
public long UserId { get; set; }
//public UserDTO User { get; set; } = null!;
//public ICollection<TranslateDTO> translation { get; set; } = new List<TranslateDTO>();
//public ICollection<GroupDTO> Groups { get; set; } = new List<GroupDTO>();
}
}

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DbContext\DbContextLib.csproj" />
<ProjectReference Include="..\DTO\DTO.csproj" />
<ProjectReference Include="..\Entities\Entities.csproj" />
<ProjectReference Include="..\StubbedContext\StubbedContextLib.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,146 @@
using DbContextLib;
using DTO;
using Entities;
using Microsoft.EntityFrameworkCore;
using StubbedContextLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTOToEntity
{
public class GroupService : IGroupService
{
private readonly UnitOfWork context = new UnitOfWork();
public GroupService()
{
}
public GroupService(StubbedContext _context)
{
context = new UnitOfWork(_context);
}
public async Task<GroupDTO> Add(GroupDTO group)
{
if(group == null)
{
throw new ArgumentNullException();
}
GroupEntity groupEntity = group.ToEntity();
context.GroupRepository.Insert(groupEntity);
await context.SaveChangesAsync();
return groupEntity.ToDTO(); ;
}
public async Task<UserDTO> AddUserToGroup(long idUser, long idGroup)
{
var group = context.GroupRepository.GetById(idGroup);
if (group == null)
{
throw new Exception("Group not found");
}
var user = context.UserRepository.GetById(idUser);
if (user == null)
{
throw new Exception("User not found");
}
group.Users.Add(user);
await context.SaveChangesAsync();
return user.ToDTO();
}
public async Task<VocabularyListDTO> AddVocabularyListToGroup(long vocabId, long groupId)
{
var group = context.GroupRepository.GetById(groupId);
if (group == null)
{
throw new Exception("Group not found");
}
var vocab = context.VocabularyListRepository.GetById(vocabId);
if (vocab == null)
{
throw new Exception("VocabularyList not found");
}
group.GroupVocabularyList.Add(vocab);
await context.SaveChangesAsync();
return vocab.ToDTO();
}
public async Task<GroupDTO> Delete(object id)
{
var group = context.GroupRepository.GetById((long)id);
if (group != null)
{
context.GroupRepository.Delete(group);
await context.SaveChangesAsync();
}else
{
throw new Exception("Group not found");
}
return group.ToDTO();
}
public async Task<GroupDTO> GetById(object id)
{
var group = context.GroupRepository.GetById((long) id);
if (group == null)
{
throw new Exception("Group not found");
}
return group.ToDTO();
}
public async Task<PageResponse<GroupDTO>> GetByNum(int index, int count, int num)
{
var groups = context.GroupRepository.GetItems(filter: g => g.Num == num, index, count);
return new PageResponse<GroupDTO>(groups.ToList().Select(g => g.ToDTO()), context.GroupRepository.GetItems(0, 1000000000).Count());
}
public async Task<PageResponse<GroupDTO>> GetBySector(int index, int count, string sector)
{
var groups = context.GroupRepository.GetItems(filter: g => g.sector == sector, index, count);
return new PageResponse<GroupDTO>(groups.ToList().Select(g => g.ToDTO()), context.GroupRepository.GetItems(0, 100000000).Count());
}
public async Task<PageResponse<GroupDTO>> GetByYear(int index, int count, int year)
{
var groups = context.GroupRepository.GetItems(filter: g => g.year == year, index, count);
return new PageResponse<GroupDTO>(groups.ToList().Select(g => g.ToDTO()), context.GroupRepository.GetItems(0,100000000).Count());
}
public async Task<PageResponse<GroupDTO>> Gets(int index, int count)
{
IEnumerable<GroupEntity> groups = context.GroupRepository.GetItems(index,count);
return new PageResponse<GroupDTO>(groups.ToList().Select(g => g.ToDTO()), context.GroupRepository.GetItems(0, 1000000000).Count());
}
public async Task<GroupDTO> Update(GroupDTO group)
{
if(group == null)
{
throw new ArgumentNullException();
}
var existingGroup = context.GroupRepository.GetById(group.Id);
if (existingGroup == null)
{
throw new Exception("Group not found");
}
existingGroup.year = group.Year;
existingGroup.sector = group.sector;
existingGroup.Num = group.Num;
await context.SaveChangesAsync();
return existingGroup.ToDTO();
}
}
}

@ -0,0 +1,20 @@
using DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTOToEntity
{
public interface IGroupService : IService<GroupDTO>
{
Task<PageResponse<GroupDTO>> GetByNum(int index, int count, int num);
Task<PageResponse<GroupDTO>> GetBySector(int index, int count, string sector);
Task<PageResponse<GroupDTO>> GetByYear(int index, int count, int year);
Task<UserDTO> AddUserToGroup(long idUser, long idGroup);
Task<VocabularyListDTO> AddVocabularyListToGroup(long vocabId, long groupId);
}
}

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace DTOToEntity
{
public interface IService<T>
{
Task<PageResponse<T>> Gets(int index, int count);
Task<T> GetById(object id);
Task<T> Add( T group);
Task<T> Delete(object id);
Task<T> Update(T group);
}
}

@ -0,0 +1,14 @@
using DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTOToEntity
{
public interface ITranslateService : IService<TranslateDTO>
{
Task<VocabularyDTO> AddVocabToTranslate(string vocabId, long translateId);
}
}

@ -0,0 +1,15 @@
using DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTOToEntity
{
public interface IUserService : IService<UserDTO>
{
Task<PageResponse<UserDTO>> GetByGroup(int index, int count, long group);
Task<PageResponse<UserDTO>> GetByRole(int index, int count, string role);
}
}

@ -0,0 +1,16 @@
using DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTOToEntity
{
public interface IVocabularyListService : IService<VocabularyListDTO>
{
Task<PageResponse<VocabularyListDTO>> GetByUser(int index, int count, int user);
Task<GroupDTO> AddGroupToVocabularyList(long groupId, long vocabId);
}
}

@ -0,0 +1,16 @@
using DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTOToEntity
{
public interface IVocabularyService : IService<VocabularyDTO>
{
Task<PageResponse<VocabularyDTO>> GetByLangue(int index, int count, string langue);
Task<TranslateDTO> AddTranslationToVocabulary(string vocabId, long translateId);
}
}

@ -0,0 +1,74 @@
using DbContextLib;
using DTO;
using Entities;
using Microsoft.EntityFrameworkCore;
using StubbedContextLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTOToEntity
{
public class LangueService : IService<LangueDTO>
{
private readonly UnitOfWork _context = new UnitOfWork();
public LangueService() { }
public LangueService(StubbedContext context)
{
this._context = new UnitOfWork(context);
}
public async Task<LangueDTO> Add(LangueDTO langue)
{
var langueEntity = langue.ToEntity();
_context.LangueRepository.Insert(langueEntity);
await _context.SaveChangesAsync();
return langue;
}
public async Task<LangueDTO> Delete(object id)
{
var langue = _context.LangueRepository.GetById(id);
if (langue != null)
{
_context.LangueRepository.Delete(langue);
await _context.SaveChangesAsync();
}
else {
throw new Exception("Langue not found");
}
return langue.ToDTO();
}
public async Task<LangueDTO> GetById(object id)
{
var langue = _context.LangueRepository.GetById(id);
if (langue == null)
{
throw new Exception("Langue not found");
}
return langue.ToDTO();
}
public async Task<PageResponse<LangueDTO>> Gets(int index,int count)
{
IEnumerable<LangueEntity> langues = _context.LangueRepository.GetItems(index, count);
return new PageResponse<LangueDTO>(langues.ToList().Select(l => l.ToDTO()), _context.LangueRepository.GetItems(0, 1000000000).Count());
}
public async Task<LangueDTO> Update(LangueDTO langue)
{
LangueEntity? langueToUpdate = _context.LangueRepository.GetById(langue.name);
if (langueToUpdate == null)
{
throw new Exception("Langue not found");
}
//langueToUpdate.vocabularys = (ICollection<VocabularyEntity>)langue.vocabularys.Select(v => v.ToEntity());
return langueToUpdate.ToDTO();
}
}
}

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTOToEntity
{
public class PageResponse<T>
{
public IEnumerable<T> Items { get; set; }
public long TotalCount { get; set; }
public PageResponse(IEnumerable<T> items, int totalCount)
{
Items = items;
TotalCount = totalCount;
}
}
}

@ -0,0 +1,81 @@
using DbContextLib;
using DTO;
using Entities;
using Microsoft.EntityFrameworkCore;
using StubbedContextLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTOToEntity
{
public class RoleService : IService<RoleDTO>
{
private readonly UnitOfWork _context = new UnitOfWork();
public RoleService() { }
public RoleService(StubbedContext context)
{
_context = new UnitOfWork(context);
}
public RoleService(UnitOfWork context)
{
_context = context;
}
public async Task<RoleDTO> Add(RoleDTO role)
{
var roleEntity = role.ToEntity();
_context.RoleRepository.Insert(roleEntity);
await _context.SaveChangesAsync();
return role;
}
public async Task<RoleDTO> Delete(object id)
{
RoleEntity role = _context.RoleRepository.GetById((long)id);
if (role == null)
{
throw new Exception("Role not found");
}
_context.RoleRepository.Delete((long)id);
await _context.SaveChangesAsync();
return role.ToDTO();
}
public async Task<RoleDTO> GetById(object id)
{
RoleEntity? role = _context.RoleRepository.GetById((long)id);
if (role == null)
{
throw new Exception("Role not found");
}
return role.ToDTO();
}
public async Task<PageResponse<RoleDTO>> Gets(int index, int count)
{
IEnumerable<RoleEntity> roles = _context.RoleRepository.GetItems(index, count);
return new PageResponse<RoleDTO>(roles.ToList().Select(r => r.ToDTO()), _context.RoleRepository.GetItems(0,1000000000).Count());
}
public async Task<RoleDTO> Update(RoleDTO role)
{
if (role == null)
{
throw new ArgumentNullException();
}
var roleEntity = _context.RoleRepository.GetById(role.Id);
if (roleEntity != null)
{
throw new Exception("role not found");
}
roleEntity.Name = role.Name;
_context.RoleRepository.Update(roleEntity);
await _context.SaveChangesAsync();
return roleEntity.ToDTO();
}
}
}

@ -0,0 +1,98 @@
using DbContextLib;
using DTO;
using Microsoft.EntityFrameworkCore;
using StubbedContextLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTOToEntity
{
public class TranslateService : ITranslateService
{
private readonly UnitOfWork _context = new UnitOfWork();
public TranslateService() { }
public TranslateService(StubbedContext context)
{
_context = new UnitOfWork(context);
}
public async Task<TranslateDTO> Add(TranslateDTO translate)
{
var translateEntity = translate.ToEntity();
_context.TranslateRepository.Insert(translateEntity);
await _context.SaveChangesAsync();
return translateEntity.ToDTO();
}
public async Task<VocabularyDTO> AddVocabToTranslate(string vocabId, long translateId)
{
var vocab = _context.VocabularyRepository.GetById(vocabId);
if (vocab == null)
{
throw new Exception("Vocabulary not found");
}
var translate = _context.TranslateRepository.GetById(translateId);
if (translate == null)
{
throw new Exception("Translate not found");
}
translate.TransVoc.Add(vocab);
await _context.SaveChangesAsync();
return vocab.ToDTO();
}
public async Task<TranslateDTO> Delete(object id)
{
var translate = _context.TranslateRepository.GetById((long)id);
if (translate != null)
{
_context.TranslateRepository.Delete(translate);
await _context.SaveChangesAsync();
}
else
{
throw new Exception("Translate not found");
}
return translate.ToDTO();
}
public async Task<TranslateDTO> GetById(object id)
{
var translate = _context.TranslateRepository.GetById((long)id);
if (translate == null)
{
throw new Exception("Translate not found");
}
return translate.ToDTO();
}
public async Task<PageResponse<TranslateDTO>> Gets(int index, int count)
{
var translates = _context.TranslateRepository.GetItems(index, count);
if(translates == null)
{
throw new Exception("No translates found");
}
return new PageResponse<TranslateDTO>( translates.Select(t => t.ToDTO()), _context.TranslateRepository.GetItems(0, 100000000).Count());
}
public async Task<TranslateDTO> Update(TranslateDTO translate)
{
var translateEntity = _context.TranslateRepository.GetById(translate.Id);
if (translateEntity == null)
{
throw new Exception("Translate not found");
}
translateEntity.WordsId = translate.WordsId;
translateEntity.VocabularyListVocId = translate.VocabularyListVocId;
_context.TranslateRepository.Update(translateEntity);
await _context.SaveChangesAsync();
return translateEntity.ToDTO();
}
}
}

@ -0,0 +1,104 @@
using DbContextLib;
using DTO;
using Entities;
using Microsoft.EntityFrameworkCore;
using StubbedContextLib;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTOToEntity
{
public class UserService : IUserService
{
private UnitOfWork _context = new UnitOfWork();
public UserService() { }
public UserService(StubbedContext context)
{
_context = new UnitOfWork(context);
}
public async Task<UserDTO> Add(UserDTO user)
{
UserEntity userEntity = user.ToEntity();
if(userEntity == null)
{
throw new Exception("User Entity is null");
}
_context.UserRepository.Insert(userEntity);
await _context.SaveChangesAsync();
return user;
}
public async Task<UserDTO> Delete(object id)
{
UserEntity? user = _context.UserRepository.GetById((long)id);
if(user == null)
{
throw new Exception("User not found");
}
_context.UserRepository.Delete((long)id);
await _context.SaveChangesAsync();
return user.ToDTO();
}
public async Task<PageResponse<UserDTO>> GetByGroup(int index, int count, long group)
{
var users = _context.UserRepository.GetItems(index,count).Where(u => u.GroupId == group);
return new PageResponse<UserDTO>(users.Select(u => u.ToDTO()), _context.UserRepository.GetItems(0,1000000000).Count());
}
public async Task<UserDTO> GetById(object id)
{
var user = _context.UserRepository.GetById((long)id);
if(user == null)
{
throw new Exception("User not found");
}
return user.ToDTO();
}
public async Task<PageResponse<UserDTO>> GetByRole(int index, int count, string role)
{
var users = _context.UserRepository.GetItems(filter: u => u.Role != null && u.Role.Name == role,
index: index,
count: count);
return new PageResponse<UserDTO>(users.Select(u => u.ToDTO()), _context.UserRepository.GetItems(0, 1000000000).Count());
}
public async Task<PageResponse<UserDTO>> Gets(int index, int count)
{
IEnumerable<UserEntity> users = _context.UserRepository.GetItems(index, count) ;
return new PageResponse<UserDTO>( users.Select(u => u.ToDTO()),_context.UserRepository.GetItems(0, 1000000000).Count());
}
public async Task<UserDTO> Update(UserDTO user)
{
if(user == null)
{
throw new Exception("User is null");
}
var existingUser = _context.UserRepository.GetById(user.Id);
if(existingUser == null)
{
throw new Exception("User not found");
}
existingUser.image = user.image;
existingUser.Name = user.Name;
existingUser.Password = user.Password;
existingUser.NickName = user.NickName;
existingUser.Email = user.Email;
existingUser.RoleId = user.RoleId;
existingUser.GroupId = user.GroupId;
existingUser.UserName = user.UserName;
existingUser.ExtraTime = user.ExtraTime;
await _context.SaveChangesAsync();
return existingUser.ToDTO();
}
}
}

@ -0,0 +1,101 @@
using DbContextLib;
using DTO;
using Microsoft.EntityFrameworkCore;
using StubbedContextLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTOToEntity
{
public class VocabularyListService : IVocabularyListService
{
private UnitOfWork _context = new UnitOfWork();
public VocabularyListService()
{
}
public VocabularyListService(StubbedContext context)
{
_context = new UnitOfWork(context);
}
public async Task<VocabularyListDTO> Add(VocabularyListDTO group)
{
var groupEntity = group.ToEntity();
_context.VocabularyListRepository.Insert(groupEntity);
await _context.SaveChangesAsync();
return groupEntity.ToDTO();
}
public async Task<GroupDTO> AddGroupToVocabularyList(long groupId, long vocabId)
{
var group = _context.GroupRepository.GetById(groupId);
if (group == null)
{
throw new Exception("Group not found");
}
var vocab = _context.VocabularyListRepository.GetById(vocabId);
if (vocab == null)
{
throw new Exception("Vocabulary List not found");
}
vocab.VocsGroups.Add(group);
await _context.SaveChangesAsync();
return group.ToDTO();
}
public async Task<VocabularyListDTO> Delete(object id)
{
var group = _context.VocabularyListRepository.GetById((long)id);
if (group != null)
{
_context.VocabularyListRepository.Delete(group);
await _context.SaveChangesAsync();
}
else
{
throw new Exception("Group not found");
}
return group.ToDTO();
}
public async Task<VocabularyListDTO> GetById(object id)
{
var group = _context.VocabularyListRepository.GetById((long)id);
if (group == null)
{
throw new Exception("Group not found");
}
return group.ToDTO();
}
public async Task<PageResponse<VocabularyListDTO>> GetByUser(int index, int count, int user)
{
var groups = _context.VocabularyListRepository.GetItems(filter: u => u.Id == user, index, count);
return new PageResponse<VocabularyListDTO>(groups.Select(g => g.ToDTO()), _context.VocabularyListRepository.GetItems(0,1000000000).Count());
}
public async Task<PageResponse<VocabularyListDTO>> Gets(int index, int count)
{
var groups = _context.VocabularyListRepository.GetItems(index, count);
return new PageResponse<VocabularyListDTO>(groups.Select(g => g.ToDTO()), _context.VocabularyListRepository.GetItems(0, 1000000000).Count());
}
public async Task<VocabularyListDTO> Update(VocabularyListDTO group)
{
var groupEntity = group.ToEntity();
if (groupEntity == null)
{
throw new Exception("Group Entity is null");
}
_context.VocabularyListRepository.Update(groupEntity);
await _context.SaveChangesAsync();
return group;
}
}
}

@ -0,0 +1,105 @@
using DbContextLib;
using DTO;
using Entities;
using Microsoft.EntityFrameworkCore;
using StubbedContextLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTOToEntity
{
public class VocabularyService : IVocabularyService
{
private readonly UnitOfWork _context = new UnitOfWork();
public VocabularyService() { }
public VocabularyService(StubbedContext context)
{
_context = new UnitOfWork(context);
}
public async Task<VocabularyDTO> Add(VocabularyDTO vocabulary)
{
var vocabularyEntity = vocabulary.ToEntity();
if(vocabularyEntity == null)
{
throw new ArgumentNullException();
}
_context.VocabularyRepository.Insert(vocabularyEntity);
await _context.SaveChangesAsync();
return vocabularyEntity.ToDTO();
}
public async Task<TranslateDTO> AddTranslationToVocabulary(string vocabId, long translateId)
{
var vocabulary = _context.VocabularyRepository.GetById(vocabId);
if(vocabulary == null)
{
throw new Exception("Vocabulary not found");
}
var translate = _context.TranslateRepository.GetById(translateId);
if(translate == null)
{
throw new Exception("Translate not found");
}
vocabulary.Voctranslations.Add(translate);
await _context.SaveChangesAsync();
return translate.ToDTO();
}
public async Task<VocabularyDTO> Delete(object id)
{
var vocabulary = _context.VocabularyRepository.GetById((string)id);
if(vocabulary == null)
{
throw new Exception("Vocabulary not found");
}
_context.VocabularyRepository.Delete(vocabulary);
await _context.SaveChangesAsync();
return vocabulary.ToDTO();
}
public async Task<VocabularyDTO> GetById(object id)
{
var vocabulary = _context.VocabularyRepository.GetById((string)id);
if(vocabulary == null)
{
throw new Exception("Vocabulary not found");
}
return vocabulary.ToDTO();
}
public async Task<PageResponse<VocabularyDTO>> GetByLangue(int index, int count, string langue)
{
var vocabularies = _context.VocabularyRepository.GetItems(filter: v => v.LangueName == langue, index, count);
return new PageResponse<VocabularyDTO>(vocabularies.ToList().Select(v => v.ToDTO()), _context.VocabularyRepository.GetItems(0,100000000).Count());
}
public async Task<PageResponse<VocabularyDTO>> Gets(int index, int count)
{
var vocabulary = _context.VocabularyRepository.GetItems(index, count);
return new PageResponse<VocabularyDTO>(vocabulary.Select(v => v.ToDTO()), _context.VocabularyRepository.GetItems(0, 100000000).Count());
}
public async Task<VocabularyDTO> Update(VocabularyDTO vocabulary)
{
VocabularyEntity vocabularyEntity = vocabulary.ToEntity();
if(vocabularyEntity == null)
{
throw new Exception("vocabulary not valid");
}
var VocabToUpdate = _context.VocabularyRepository.GetById(vocabulary.word);
if(VocabToUpdate == null)
{
throw new Exception("vocabulary not found");
}
VocabToUpdate.LangueName = vocabularyEntity.LangueName;
await _context.SaveChangesAsync();
return vocabularyEntity.ToDTO();
}
}
}

@ -0,0 +1,172 @@
using DTO;
using Entities;
namespace DTOToEntity
{
public static class Extensions
{
public static GroupEntity ToEntity( this GroupDTO group)
{
return new GroupEntity
{
Id = group.Id,
Num = group.Num,
year = group.Year,
sector = group.sector,
//Users = group.Users.Select(u => u.ToEntity()).ToList(),
//GroupVocabularyList = group.GroupVocabularyList.Select(v => v.ToEntity()).ToList()
};
}
public static GroupDTO ToDTO(this GroupEntity group)
{
return new GroupDTO
{
Id = group.Id,
Num = group.Num,
Year = group.year,
sector = group.sector,
//Users = group.Users.Select(u => u.ToDTO()).ToList(),
//GroupVocabularyList = group.GroupVocabularyList.Select(v => v.ToDTO()).ToList()
};
}
public static LangueEntity ToEntity(this LangueDTO langue)
{
return new LangueEntity
{
name = langue.name,
//vocabularys = langue.vocabularys.Select(v => v.ToEntity()).ToList()
};
}
public static LangueDTO ToDTO(this LangueEntity langue)
{
return new LangueDTO
{
name = langue.name,
//vocabularys = langue.vocabularys.Select(v => v.ToDTO()).ToList()
};
}
public static RoleEntity ToEntity(this RoleDTO role)
{
return new RoleEntity
{
Id = role.Id,
Name = role.Name,
//Users = role.Users.Select(u => u.ToEntity()).ToList()
};
}
public static RoleDTO ToDTO(this RoleEntity role)
{
return new RoleDTO
{
Id = role.Id,
Name = role.Name,
//Users = role.Users.Select(u => u.ToDTO()).ToList()
};
}
public static TranslateEntity ToEntity(this TranslateDTO translate)
{
return new TranslateEntity
{
Id = translate.Id,
WordsId = translate.WordsId,
//TransVoc = translate.TransVoc.Select(w => w.ToEntity()).ToList(),
//VocabularyListVoc = translate.VocabularyListVoc.ToEntity(),
VocabularyListVocId = translate.VocabularyListVocId,
};
}
public static TranslateDTO ToDTO(this TranslateEntity translate)
{
return new TranslateDTO
{
Id = translate.Id,
WordsId = translate.WordsId,
//TransVoc = translate.TransVoc.Select(w => w.ToDTO()).ToList(),
//VocabularyListVoc = translate.VocabularyListVoc.ToDTO(),
VocabularyListVocId = translate.VocabularyListVocId,
};
}
public static UserEntity ToEntity(this UserDTO user)
{
return new UserEntity
{
Id = user.Id,
Name = user.Name,
Email = user.Email,
UserName = user.UserName,
NickName = user.NickName,
image = user.image,
Password = user.Password,
GroupId = user.GroupId,
RoleId = user.RoleId,
ExtraTime = user.ExtraTime
//Group = user.Group.ToEntity(),
//Role = user.Role.ToEntity()
};
}
public static UserDTO ToDTO(this UserEntity user)
{
return new UserDTO
{
Id = user.Id,
Name = user.Name,
Email = user.Email,
UserName = user.UserName,
NickName = user.NickName,
image = user.image,
Password = user.Password,
GroupId = user.GroupId,
RoleId = user.RoleId,
ExtraTime = user.ExtraTime,
//Group = user.Group.ToDTO(),
//Role = user.Role.ToDTO()
};
}
public static VocabularyEntity ToEntity(this VocabularyDTO vocabulary)
{
return new VocabularyEntity
{
word = vocabulary.word,
//Voctranslations = vocabulary.Voctranslations.Select(t => t.ToEntity()).ToList(),
LangueName = vocabulary.LangueName,
//Langue = vocabulary.Langue.ToEntity()
};
}
public static VocabularyDTO ToDTO(this VocabularyEntity vocabulary)
{
return new VocabularyDTO
{
word = vocabulary.word,
//Voctranslations = vocabulary.Voctranslations.Select(t => t.ToDTO()).ToList(),
LangueName = vocabulary.LangueName,
//Langue = vocabulary.Langue.ToDTO()
};
}
public static VocabularyListEntity ToEntity(this VocabularyListDTO vocabularyList)
{
return new VocabularyListEntity
{
Id = vocabularyList.Id,
Name = vocabularyList.Name,
Image = vocabularyList.Image,
UserId = vocabularyList.UserId,
//translations = vocabularyList.translations.Select(t => t.ToEntity()).ToList(),
//VocsGroups = vocabularyList.VocsGroups.Select(g => g.ToEntity()).ToList()
};
}
public static VocabularyListDTO ToDTO(this VocabularyListEntity vocabularyList)
{
return new VocabularyListDTO
{
Id = vocabularyList.Id,
Name = vocabularyList.Name,
Image = vocabularyList.Image,
UserId = vocabularyList.UserId,
//translations = vocabularyList.translations.Select(t => t.ToDTO()).ToList(),
//VocsGroups = vocabularyList.VocsGroups.Select(g => g.ToDTO()).ToList()
};
}
}
}

@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<StartWorkingDirectory>$(MSBuildProjectDirectory)</StartWorkingDirectory>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Entities\Entities.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,33 @@
using System.Collections.Generic;
using Entities;
using Microsoft.EntityFrameworkCore;
namespace DbContextLib
{
public class SAEContext : DbContext
{
// DbSet<BookEntity> est une propriété dans le contexte de base de données (DbContext) qui représente une table de livres dans la base de données.
public DbSet<UserEntity> Users { get; set; }
public DbSet<GroupEntity> Groups { get; set; }
public DbSet<LangueEntity> Langues { get; set; }
public DbSet<RoleEntity> Roles { get; set; }
public DbSet<TranslateEntity> Translates { get; set; }
public DbSet<VocabularyEntity> Vocabularys { get; set; }
public DbSet<VocabularyListEntity> VocabularyLists { get; set; }
//permet de créer une base de donnée (fichier .db) ici en Sqlite avec le nom Db.Books.db
public SAEContext(DbContextOptions<SAEContext> options): base(options)
{
}
public SAEContext()
{
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
optionsBuilder.UseSqlite($"Data Source=Db.in_english_please.db");
}
}
}

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>

@ -0,0 +1,23 @@
using System.ComponentModel.DataAnnotations;
namespace Entities
{
public class GroupEntity
{
[Key]
public long Id { get; set; }
public int Num { get; set; }
public int year { get; set; }
public string sector { get; set; }
public ICollection<UserEntity> Users { get; set; } = new List<UserEntity>();
public ICollection<VocabularyListEntity> GroupVocabularyList { get; set; } = new List<VocabularyListEntity>();
public string toString()
{
return "Id: " + Id + " Num: " + Num + " year: " + year + " sector: " + sector;
}
}
}

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Entities
{
public class LangueEntity
{
[Key]
public string name { get; set; }
public ICollection<VocabularyEntity> vocabularys { get; set; } = new List<VocabularyEntity>();
}
}

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Entities
{
public class RoleEntity
{
public long Id { get; set; }
public string Name { get; set; }
public ICollection<UserEntity> Users { get; set; } = new List<UserEntity>();
public string toString()
{
return Id +" " + Name;
}
}
}

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Entities
{
public class TranslateEntity
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
[ForeignKey(nameof(WordsId))]
public string WordsId { get; set; }
public ICollection<VocabularyEntity> TransVoc { get; set; } = new List<VocabularyEntity>();
[ForeignKey(nameof(VocabularyListVocId))]
public long VocabularyListVocId { get; set; }
public VocabularyListEntity? VocabularyListVoc { get; set; } = null!;
public string toString()
{
return "Id : " + Id +" wordId : " + WordsId + " VocabularyListVocId : " + VocabularyListVocId ;
}
}
}

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Entities
{
public class UserEntity
{
public long Id { get; set; }
public string Password { get; set; }
public string Email { get; set; }
public string Name { get; set; }
public string UserName { get; set; }
public string NickName { get; set; }
public string? image { get; set; } = null;
[ForeignKey(nameof(GroupId))]
public long GroupId { get; set; }
public GroupEntity? Group { get; set; } = null;
[ForeignKey(nameof(RoleId))]
public long RoleId { get; set; }
public RoleEntity? Role { get; set; } = null;
public Boolean ExtraTime { get; set; }
public ICollection<VocabularyListEntity> VocabularyList { get; set; } = new List<VocabularyListEntity>();
public string toString()
{
return "Id: " + Id + " Password: " + Password + " Email: " + Email + " Name: " + Name + " UserName: " + UserName + " NickName: " + NickName + " GroupId: " + GroupId + " RoleId: " + RoleId + " ExtraTime: " + ExtraTime;
}
}
}

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Entities
{
public class VocabularyEntity
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public string word { get; set; }
public ICollection<TranslateEntity> Voctranslations { get; set; } = new List<TranslateEntity>();
[ForeignKey(nameof(LangueName))]
public string LangueName { get; set; }
public LangueEntity? Langue { get; set; } = null!;
public string toString()
{
return word + " " + LangueName ;
}
}
}

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Entities
{
public class VocabularyListEntity
{
public long Id { get; set; }
public string Name { get; set; }
public string Image { get; set; }
[ForeignKey(nameof(UserId))]
public long UserId { get; set; }
public UserEntity? User { get; set; } = null;
public ICollection<TranslateEntity> translations { get; set; } = new List<TranslateEntity>();
public ICollection<GroupEntity> VocsGroups { get; set; } = new List<GroupEntity>();
public string toString()
{
return "Id : " + Id + " Name : " + Name + " Image : " + Image + " UserId : " + UserId;
}
}
}

@ -0,0 +1,15 @@
namespace Modele
{
public class Group
{
public int Id { get; set; }
public int Num { get; set; }
public int year { get; set; }
public string sector { get; set; }
public ICollection<User> Users { get; set; } = new List<User>();
public ICollection<VocabularyList> VocabularyList { get; set; } = new List<VocabularyList>();
}
}

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modele
{
public interface IDataManager<T>
{
Task<IEnumerable<T>> Gets();
Task<T> GetById(int id);
Task<T> AddGroup(T group);
Task<T> DeleteGroup(int id);
Task<T> UpdateGroup(T group);
}
}

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modele
{
public class Langue
{
public string name { get; set; }
public ICollection<Vocabulary> vocabularys { get; set; } = new List<Vocabulary>();
}
}

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modele
{
public class Role
{
public int Id { get; set; }
public string Name { get; set; }
public ICollection<User> Users { get; set; } = new List<User>();
}
}

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modele
{
public class Translate
{
public int Id { get; set; }
[ForeignKey(nameof(WordsId))]
public string WordsId { get; set; }
public ICollection<Vocabulary> Words { get; set; } = new List<Vocabulary>();
public long VocabularyListVocId { get; set; }
public VocabularyList VocabularyListVoc { get; set; } = null!;
}
}

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modele
{
public class User
{
public long Id { get; set; }
public string Password { get; set; }
public string Email { get; set; }
public string Name { get; set; }
public string UserName { get; set; }
public string NickName { get; set; }
public string? image { get; set; } = null;
public long GroupId { get; set; }
public Group? Group { get; set; } = null;
public long RoleId { get; set; }
public Role? Role { get; set; } = null!;
public Boolean ExtraTime { get; set; }
public ICollection<VocabularyList> VocabularyList { get; set; } = new List<VocabularyList>();
}
}

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modele
{
public class Vocabulary
{
public string word { get; set; }
public ICollection<Translate> translations { get; } = new List<Translate>();
public string LangueName { get; set; }
public Langue? Langue { get; set; } = null!;
}
}

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modele
{
public class VocabularyList
{
public int Id { get; set; }
public string Name { get; set; }
public string Image { get; set; }
public long UserId { get; set; }
public User User { get; set; } = null!;
public ICollection<Translate> translation { get; set; } = new List<Translate>();
public ICollection<Group> Groups { get; set; } = new List<Group>();
}
}

@ -0,0 +1,38 @@
using DbContextLib;
using DTO;
using Modele;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ModeleToDTO
{
public class GroupDataManager(LibraryContext _context) : IModele2DTO<GroupDTO, Group>
{
public Task<GroupDTO> Add(Group group)
{
throw new NotImplementedException();
}
public Task<GroupDTO> Delete(int id)
{
throw new NotImplementedException();
}
public Task<GroupDTO> GetById(int id)
{
throw new NotImplementedException();
}
public Task<IEnumerable<GroupDTO>> Gets()
{
throw new NotImplementedException();
}
public Task<GroupDTO> Update(Group group)
{
throw new NotImplementedException();
}
}
}

@ -0,0 +1,13 @@
namespace ModeleToDTO
{
public interface IModele2DTO<T, TModele>
{
Task<IEnumerable<T>> Gets();
Task<T> GetById(int id);
Task<T> Add(TModele group);
Task<T> Delete(int id);
Task<T> Update(TModele group);
}
}

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DbContext\DbContextLib.csproj" />
<ProjectReference Include="..\DTO\DTO.csproj" />
<ProjectReference Include="..\Modele\Modele.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ModeleToDTO
{
public class extensions
{
}
}

@ -0,0 +1,167 @@
using Entities;
using Modele;
namespace ModeleToEntities
{
public static class Extensions
{
public static GroupEntity ToEntity(this Group group)
{
return new GroupEntity
{
Id = group.Id,
Num = group.Num,
year = group.year,
sector = group.sector,
VocabularyList = group.VocabularyList.Select(v => v.ToEntity()).ToList()
};
}
public static Group ToModel(this GroupEntity group)
{
return new Group
{
Id = group.Id,
Num = group.Num,
year = group.year,
sector = group.sector,
VocabularyList = group.VocabularyList.Select(v => v.ToModel()).ToList()
};
}
public static VocabularyListEntity ToEntity(this VocabularyList vocabularyList)
{
return new VocabularyListEntity
{
Id = vocabularyList.Id,
Name = vocabularyList.Name,
Image = vocabularyList.Image,
UserId = vocabularyList.UserId,
translation = vocabularyList.translation.Select(t => t.ToEntity()).ToList(),
Groups = vocabularyList.Groups.Select(g => g.ToEntity()).ToList()
};
}
public static VocabularyList ToModel(this VocabularyListEntity vocabularyList)
{
return new VocabularyList
{
Id = vocabularyList.Id,
Name = vocabularyList.Name,
Image = vocabularyList.Image,
UserId = vocabularyList.UserId,
translation = vocabularyList.translation.Select(t => t.ToModel()).ToList(),
Groups = vocabularyList.Groups.Select(g => g.ToModel()).ToList()
};
}
public static TranslateEntity ToEntity(this Translate translate)
{
return new TranslateEntity
{
Id = translate.Id,
WordsId = translate.WordsId,
Words = translate.Words.Select(w => w.ToEntity()).ToList(),
VocabularyListVocId = translate.VocabularyListVocId,
VocabularyListVoc = translate.VocabularyListVoc.ToEntity()
};
}
public static Translate ToModel(this TranslateEntity translate)
{
return new Translate
{
Id = translate.Id,
WordsId = translate.WordsId,
Words = translate.Words.Select(w => w.ToModel()).ToList(),
VocabularyListVocId = translate.VocabularyListVocId,
VocabularyListVoc = translate.VocabularyListVoc.ToModel()
};
}
public static VocabularyEntity ToEntity(this Vocabulary vocabulary)
{
return new VocabularyEntity
{
word = vocabulary.word,
LangueName = vocabulary.LangueName
};
}
public static Vocabulary ToModel(this VocabularyEntity vocabulary)
{
return new Vocabulary
{
word = vocabulary.word,
LangueName = vocabulary.LangueName
};
}
public static UserEntity ToEntity(this User user)
{
return new UserEntity
{
Id = user.Id,
Name = user.Name,
UserName = user.UserName,
NickName = user.NickName,
ExtraTime = user.ExtraTime,
GroupId = user.GroupId,
Password = user.Password,
Email = user.Email
};
}
public static User ToModel(this UserEntity user)
{
return new User
{
Id = user.Id,
Name = user.Name,
UserName = user.UserName,
NickName = user.NickName,
ExtraTime = user.ExtraTime,
GroupId = user.GroupId,
Password = user.Password,
Email = user.Email
};
}
public static RoleEntity ToEntity(this Role role)
{
return new RoleEntity
{
Id = role.Id,
Name = role.Name
};
}
public static Role ToModel(this RoleEntity role)
{
return new Role
{
Id = role.Id,
Name = role.Name
};
}
public static LangueEntity ToEntity(this Langue langue)
{
return new LangueEntity
{
name = langue.name
};
}
public static Langue ToModel(this LangueEntity langue)
{
return new Langue
{
name = langue.name
};
}
}
}

@ -0,0 +1,69 @@
using Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options;
using StubbedContextLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ModeleToEntities
{
public class GroupService : IService<GroupEntity>
{
private readonly StubbedContext _context = new StubbedContext();
public GroupService()
{
}
public async Task<GroupEntity> Add(GroupEntity group)
{
_context.Groups.Add(group);
await _context.SaveChangesAsync();
return group;
}
public async Task<GroupEntity> Delete(int id)
{
var group = await _context.Groups.FindAsync(id);
if (group != null)
{
_context.Groups.Remove(group);
await _context.SaveChangesAsync();
}
return group;
}
public async Task<GroupEntity> GetById(int id)
{
var group = await _context.Groups.FindAsync(id);
if (group == null)
{
throw new Exception("Group not found");
}
return group;
}
public async Task<IEnumerable<GroupEntity>> Gets()
{
var groups = await _context.Groups.ToListAsync();
return groups;
}
public async Task<GroupEntity> Update(GroupEntity group)
{
var groupToUpdate = await _context.Groups.FindAsync(group.Id);
if (groupToUpdate == null)
{
throw new Exception("Group not found");
}
groupToUpdate.sector = group.sector;
groupToUpdate.year = group.year;
await _context.SaveChangesAsync();
return groupToUpdate;
}
}
}

@ -0,0 +1,18 @@
using Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ModeleToEntities
{
public interface IService<T>
{
Task<IEnumerable<T>> Gets();
Task<T> GetById(int id);
Task<T> Add(T group);
Task<T> Delete(int id);
Task<T> Update(T group);
}
}

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Entities\Entities.csproj" />
<ProjectReference Include="..\Modele\Modele.csproj" />
<ProjectReference Include="..\StubbedContext\StubbedContextLib.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,11 @@
namespace Modeles
{
public class Group
{
public int Id { get; set; }
public int Num { get; set; }
public int year { get; set; }
public string sector { get; set; }
}
}

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modeles
{
public class Langue
{
public string name { get; set; }
}
}

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modeles
{
public class Role
{
public int Id { get; set; }
public string Name { get; set; }
}
}

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modeles
{
public class Translate
{
public int Id { get; set; }
//public string Words1 { get; set; }
//public string Words2 { get; set; }
}
}

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modeles
{
public class User
{
public long Id { get; set; }
public string Password { get; set; }
public string Email { get; set; }
public string Name { get; set; }
public string UserName { get; set; }
public string NickName { get; set; }
public string? image { get; set; } = null;
//public long Group { get; set; }
//public string Role { get; set; }
public Boolean ExtraTime { get; set; }
}
}

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modeles
{
public class Vocabulary
{
public string word { get; set; }
public string LangueName { get; set; }
}
}

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modeles
{
public class VocabularyList
{
public int Id { get; set; }
public string Name { get; set; }
public string Image { get; set; }
//public long User { get; set; }
}
}

@ -0,0 +1,169 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace DbContextLib
{
public class GenericRepository<TEntity> where TEntity : class
{
private DbContext Context { get; set; }
private DbSet<TEntity> Set { get; set; }
public GenericRepository(DbContext context)
{
Context = context;
Set = Context.Set<TEntity>();
}
public virtual TEntity? GetById(object id)
{
return Context.Set<TEntity>().Find(id);
}
public virtual IEnumerable<TEntity> GetItems(Expression<Func<TEntity, bool>>? filter = null,
int index = 0, int count = 10,
params string[] includeProperties)
=> GetItems(filter, null, index, count, includeProperties);
public virtual IEnumerable<TEntity> GetItems(Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>>? orderBy = null,
int index = 0, int count = 10,
params string[] includeProperties)
=> GetItems(null, orderBy, index, count, includeProperties);
public virtual IEnumerable<TEntity> GetItems(int index = 0, int count = 10,
params string[] includeProperties)
=> GetItems(null, null, index, count, includeProperties);
public virtual IEnumerable<TEntity> GetItems(Expression<Func<TEntity, bool>>? filter = null,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>>? orderBy = null,
int index = 0, int count = 10,
params string[] includeProperties)
{
IQueryable<TEntity> query = Set;
if (filter != null)
{
query = query.Where(filter);
}
foreach (string includeProperty in includeProperties)
{
query = query.Include(includeProperty);
}
if (orderBy != null)
{
query = orderBy(query);
}
return query.Skip(index * count)
.Take(count)
.ToList();
}
public virtual void Insert(TEntity entity)
{
var primaryKeyProperty = Context.Model.FindEntityType(typeof(TEntity)).FindPrimaryKey().Properties.FirstOrDefault();
if (primaryKeyProperty != null)
{
var parameter = Expression.Parameter(typeof(TEntity), "x");
var property = Expression.Property(parameter, primaryKeyProperty.Name);
var idValue = Expression.Constant(primaryKeyProperty.GetGetter().GetClrValue(entity));
var equal = Expression.Equal(property, idValue);
var lambda = Expression.Lambda<Func<TEntity, bool>>(equal, parameter);
var existingEntity = Set.Local.FirstOrDefault(lambda.Compile());
if (existingEntity != null)
{
Set.Entry(existingEntity).Property("Count").CurrentValue = (int)Set.Entry(existingEntity).Property("Count").CurrentValue + 1;
}
else
{
Set.Add(entity);
}
}
else
{
throw new InvalidOperationException("Cannot find primary key property for entity type.");
}
}
public virtual void Insert(params TEntity[] entities)
{
foreach (var entity in entities)
{
Insert(entity);
}
}
public virtual void Delete(object id)
{
TEntity? entity = Set.Find(id);
if (entity == null) return;
Delete(entity);
}
public virtual void Delete(TEntity entity)
{
var primaryKeyProperty = Context.Model.FindEntityType(typeof(TEntity)).FindPrimaryKey().Properties.FirstOrDefault();
if (primaryKeyProperty != null)
{
var parameter = Expression.Parameter(typeof(TEntity), "x");
var property = Expression.Property(parameter, primaryKeyProperty.Name);
var idValue = Expression.Constant(primaryKeyProperty.GetGetter().GetClrValue(entity));
var equal = Expression.Equal(property, idValue);
var lambda = Expression.Lambda<Func<TEntity, bool>>(equal, parameter);
var existingEntity = Set.Local.FirstOrDefault(lambda.Compile());
if (existingEntity == null)
{
if (Context.Entry(entity).State == EntityState.Detached)
{
Set.Attach(entity);
}
Set.Remove(entity);
}
else
{
Set.Remove(existingEntity);
}
}
else
{
throw new InvalidOperationException("Cannot find primary key property for entity type.");
}
}
public virtual void Update(TEntity entity)
{
var primaryKeyProperty = Context.Model.FindEntityType(typeof(TEntity)).FindPrimaryKey().Properties.FirstOrDefault();
if (primaryKeyProperty != null)
{
var parameter = Expression.Parameter(typeof(TEntity), "x");
var property = Expression.Property(parameter, primaryKeyProperty.Name);
var idValue = Expression.Constant(primaryKeyProperty.GetGetter().GetClrValue(entity));
var equal = Expression.Equal(property, idValue);
var lambda = Expression.Lambda<Func<TEntity, bool>>(equal, parameter);
var existingEntity = Set.Local.FirstOrDefault(lambda.Compile());
if (existingEntity != null)
{
Context.Entry(existingEntity).CurrentValues.SetValues(entity);
}
else
{
Set.Attach(entity);
Context.Entry(entity).State = EntityState.Modified;
}
}
else
{
throw new InvalidOperationException("Cannot find primary key property for entity type.");
}
}
}
}

@ -0,0 +1,412 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using StubbedContextLib;
#nullable disable
namespace StubbedContextLib.Migrations
{
[DbContext(typeof(StubbedContext))]
[Migration("20240331212614_newMigs")]
partial class newMigs
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.1");
modelBuilder.Entity("Entities.GroupEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Num")
.HasColumnType("INTEGER");
b.Property<string>("sector")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("year")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("Groups");
b.HasData(
new
{
Id = 1L,
Num = 1,
sector = "informatics",
year = 1
});
});
modelBuilder.Entity("Entities.LangueEntity", b =>
{
b.Property<string>("name")
.HasColumnType("TEXT");
b.HasKey("name");
b.ToTable("Langues");
b.HasData(
new
{
name = "French"
},
new
{
name = "English"
});
});
modelBuilder.Entity("Entities.RoleEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Roles");
b.HasData(
new
{
Id = 1L,
Name = "Admin"
},
new
{
Id = 2L,
Name = "Teacher"
},
new
{
Id = 3L,
Name = "Student"
});
});
modelBuilder.Entity("Entities.TranslateEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("VocabularyListVocId")
.HasColumnType("INTEGER");
b.Property<string>("WordsId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("VocabularyListVocId");
b.ToTable("Translates");
b.HasData(
new
{
Id = 1L,
VocabularyListVocId = 1L,
WordsId = "1"
});
});
modelBuilder.Entity("Entities.UserEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("ExtraTime")
.HasColumnType("INTEGER");
b.Property<long>("GroupId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("NickName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("TEXT");
b.Property<long>("RoleId")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("image")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("GroupId");
b.HasIndex("RoleId");
b.ToTable("Users");
b.HasData(
new
{
Id = 1L,
Email = "",
ExtraTime = true,
GroupId = 1L,
Name = "name",
NickName = "nickname",
Password = "1234",
RoleId = 1L,
UserName = "username"
},
new
{
Id = 2L,
Email = "",
ExtraTime = true,
GroupId = 1L,
Name = "name2",
NickName = "nickname2",
Password = "1234",
RoleId = 2L,
UserName = "username2"
},
new
{
Id = 3L,
Email = "",
ExtraTime = true,
GroupId = 1L,
Name = "name3",
NickName = "nickname3",
Password = "1234",
RoleId = 3L,
UserName = "username3"
});
});
modelBuilder.Entity("Entities.VocabularyEntity", b =>
{
b.Property<string>("word")
.HasColumnType("TEXT");
b.Property<string>("LangueName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("word");
b.HasIndex("LangueName");
b.ToTable("Vocabularys");
b.HasData(
new
{
word = "Bonjour",
LangueName = "French"
});
});
modelBuilder.Entity("Entities.VocabularyListEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Image")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<long>("UserId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("VocabularyLists");
b.HasData(
new
{
Id = 1L,
Image = "image1",
Name = "Liste1",
UserId = 1L
});
});
modelBuilder.Entity("GroupEntityVocabularyListEntity", b =>
{
b.Property<long>("GroupVocabularyListId")
.HasColumnType("INTEGER");
b.Property<long>("VocsGroupsId")
.HasColumnType("INTEGER");
b.HasKey("GroupVocabularyListId", "VocsGroupsId");
b.HasIndex("VocsGroupsId");
b.ToTable("GroupEntityVocabularyListEntity");
});
modelBuilder.Entity("TranslateEntityVocabularyEntity", b =>
{
b.Property<string>("TransVocword")
.HasColumnType("TEXT");
b.Property<long>("VoctranslationsId")
.HasColumnType("INTEGER");
b.HasKey("TransVocword", "VoctranslationsId");
b.HasIndex("VoctranslationsId");
b.ToTable("TranslateEntityVocabularyEntity");
});
modelBuilder.Entity("Entities.TranslateEntity", b =>
{
b.HasOne("Entities.VocabularyListEntity", "VocabularyListVoc")
.WithMany("translations")
.HasForeignKey("VocabularyListVocId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("VocabularyListVoc");
});
modelBuilder.Entity("Entities.UserEntity", b =>
{
b.HasOne("Entities.GroupEntity", "Group")
.WithMany("Users")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.RoleEntity", "Role")
.WithMany("Users")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Group");
b.Navigation("Role");
});
modelBuilder.Entity("Entities.VocabularyEntity", b =>
{
b.HasOne("Entities.LangueEntity", "Langue")
.WithMany("vocabularys")
.HasForeignKey("LangueName")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Langue");
});
modelBuilder.Entity("Entities.VocabularyListEntity", b =>
{
b.HasOne("Entities.UserEntity", "User")
.WithMany("VocabularyList")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("GroupEntityVocabularyListEntity", b =>
{
b.HasOne("Entities.VocabularyListEntity", null)
.WithMany()
.HasForeignKey("GroupVocabularyListId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.GroupEntity", null)
.WithMany()
.HasForeignKey("VocsGroupsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("TranslateEntityVocabularyEntity", b =>
{
b.HasOne("Entities.VocabularyEntity", null)
.WithMany()
.HasForeignKey("TransVocword")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.TranslateEntity", null)
.WithMany()
.HasForeignKey("VoctranslationsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Entities.GroupEntity", b =>
{
b.Navigation("Users");
});
modelBuilder.Entity("Entities.LangueEntity", b =>
{
b.Navigation("vocabularys");
});
modelBuilder.Entity("Entities.RoleEntity", b =>
{
b.Navigation("Users");
});
modelBuilder.Entity("Entities.UserEntity", b =>
{
b.Navigation("VocabularyList");
});
modelBuilder.Entity("Entities.VocabularyListEntity", b =>
{
b.Navigation("translations");
});
#pragma warning restore 612, 618
}
}
}

@ -0,0 +1,310 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace StubbedContextLib.Migrations
{
/// <inheritdoc />
public partial class newMigs : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Groups",
columns: table => new
{
Id = table.Column<long>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Num = table.Column<int>(type: "INTEGER", nullable: false),
year = table.Column<int>(type: "INTEGER", nullable: false),
sector = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Groups", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Langues",
columns: table => new
{
name = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Langues", x => x.name);
});
migrationBuilder.CreateTable(
name: "Roles",
columns: table => new
{
Id = table.Column<long>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Roles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Vocabularys",
columns: table => new
{
word = table.Column<string>(type: "TEXT", nullable: false),
LangueName = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Vocabularys", x => x.word);
table.ForeignKey(
name: "FK_Vocabularys_Langues_LangueName",
column: x => x.LangueName,
principalTable: "Langues",
principalColumn: "name",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<long>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Password = table.Column<string>(type: "TEXT", nullable: false),
Email = table.Column<string>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
UserName = table.Column<string>(type: "TEXT", nullable: false),
NickName = table.Column<string>(type: "TEXT", nullable: false),
image = table.Column<string>(type: "TEXT", nullable: true),
GroupId = table.Column<long>(type: "INTEGER", nullable: false),
RoleId = table.Column<long>(type: "INTEGER", nullable: false),
ExtraTime = table.Column<bool>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
table.ForeignKey(
name: "FK_Users_Groups_GroupId",
column: x => x.GroupId,
principalTable: "Groups",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Users_Roles_RoleId",
column: x => x.RoleId,
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "VocabularyLists",
columns: table => new
{
Id = table.Column<long>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false),
Image = table.Column<string>(type: "TEXT", nullable: false),
UserId = table.Column<long>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_VocabularyLists", x => x.Id);
table.ForeignKey(
name: "FK_VocabularyLists_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "GroupEntityVocabularyListEntity",
columns: table => new
{
GroupVocabularyListId = table.Column<long>(type: "INTEGER", nullable: false),
VocsGroupsId = table.Column<long>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GroupEntityVocabularyListEntity", x => new { x.GroupVocabularyListId, x.VocsGroupsId });
table.ForeignKey(
name: "FK_GroupEntityVocabularyListEntity_Groups_VocsGroupsId",
column: x => x.VocsGroupsId,
principalTable: "Groups",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_GroupEntityVocabularyListEntity_VocabularyLists_GroupVocabularyListId",
column: x => x.GroupVocabularyListId,
principalTable: "VocabularyLists",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Translates",
columns: table => new
{
Id = table.Column<long>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
WordsId = table.Column<string>(type: "TEXT", nullable: false),
VocabularyListVocId = table.Column<long>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Translates", x => x.Id);
table.ForeignKey(
name: "FK_Translates_VocabularyLists_VocabularyListVocId",
column: x => x.VocabularyListVocId,
principalTable: "VocabularyLists",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TranslateEntityVocabularyEntity",
columns: table => new
{
TransVocword = table.Column<string>(type: "TEXT", nullable: false),
VoctranslationsId = table.Column<long>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TranslateEntityVocabularyEntity", x => new { x.TransVocword, x.VoctranslationsId });
table.ForeignKey(
name: "FK_TranslateEntityVocabularyEntity_Translates_VoctranslationsId",
column: x => x.VoctranslationsId,
principalTable: "Translates",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TranslateEntityVocabularyEntity_Vocabularys_TransVocword",
column: x => x.TransVocword,
principalTable: "Vocabularys",
principalColumn: "word",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "Groups",
columns: new[] { "Id", "Num", "sector", "year" },
values: new object[] { 1L, 1, "informatics", 1 });
migrationBuilder.InsertData(
table: "Langues",
column: "name",
values: new object[]
{
"English",
"French"
});
migrationBuilder.InsertData(
table: "Roles",
columns: new[] { "Id", "Name" },
values: new object[,]
{
{ 1L, "Admin" },
{ 2L, "Teacher" },
{ 3L, "Student" }
});
migrationBuilder.InsertData(
table: "Users",
columns: new[] { "Id", "Email", "ExtraTime", "GroupId", "Name", "NickName", "Password", "RoleId", "UserName", "image" },
values: new object[,]
{
{ 1L, "", true, 1L, "name", "nickname", "1234", 1L, "username", null },
{ 2L, "", true, 1L, "name2", "nickname2", "1234", 2L, "username2", null },
{ 3L, "", true, 1L, "name3", "nickname3", "1234", 3L, "username3", null }
});
migrationBuilder.InsertData(
table: "Vocabularys",
columns: new[] { "word", "LangueName" },
values: new object[] { "Bonjour", "French" });
migrationBuilder.InsertData(
table: "VocabularyLists",
columns: new[] { "Id", "Image", "Name", "UserId" },
values: new object[] { 1L, "image1", "Liste1", 1L });
migrationBuilder.InsertData(
table: "Translates",
columns: new[] { "Id", "VocabularyListVocId", "WordsId" },
values: new object[] { 1L, 1L, "1" });
migrationBuilder.CreateIndex(
name: "IX_GroupEntityVocabularyListEntity_VocsGroupsId",
table: "GroupEntityVocabularyListEntity",
column: "VocsGroupsId");
migrationBuilder.CreateIndex(
name: "IX_TranslateEntityVocabularyEntity_VoctranslationsId",
table: "TranslateEntityVocabularyEntity",
column: "VoctranslationsId");
migrationBuilder.CreateIndex(
name: "IX_Translates_VocabularyListVocId",
table: "Translates",
column: "VocabularyListVocId");
migrationBuilder.CreateIndex(
name: "IX_Users_GroupId",
table: "Users",
column: "GroupId");
migrationBuilder.CreateIndex(
name: "IX_Users_RoleId",
table: "Users",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "IX_VocabularyLists_UserId",
table: "VocabularyLists",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_Vocabularys_LangueName",
table: "Vocabularys",
column: "LangueName");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "GroupEntityVocabularyListEntity");
migrationBuilder.DropTable(
name: "TranslateEntityVocabularyEntity");
migrationBuilder.DropTable(
name: "Translates");
migrationBuilder.DropTable(
name: "Vocabularys");
migrationBuilder.DropTable(
name: "VocabularyLists");
migrationBuilder.DropTable(
name: "Langues");
migrationBuilder.DropTable(
name: "Users");
migrationBuilder.DropTable(
name: "Groups");
migrationBuilder.DropTable(
name: "Roles");
}
}
}

@ -0,0 +1,409 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using StubbedContextLib;
#nullable disable
namespace StubbedContextLib.Migrations
{
[DbContext(typeof(StubbedContext))]
partial class StubbedContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.1");
modelBuilder.Entity("Entities.GroupEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Num")
.HasColumnType("INTEGER");
b.Property<string>("sector")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("year")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("Groups");
b.HasData(
new
{
Id = 1L,
Num = 1,
sector = "informatics",
year = 1
});
});
modelBuilder.Entity("Entities.LangueEntity", b =>
{
b.Property<string>("name")
.HasColumnType("TEXT");
b.HasKey("name");
b.ToTable("Langues");
b.HasData(
new
{
name = "French"
},
new
{
name = "English"
});
});
modelBuilder.Entity("Entities.RoleEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Roles");
b.HasData(
new
{
Id = 1L,
Name = "Admin"
},
new
{
Id = 2L,
Name = "Teacher"
},
new
{
Id = 3L,
Name = "Student"
});
});
modelBuilder.Entity("Entities.TranslateEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("VocabularyListVocId")
.HasColumnType("INTEGER");
b.Property<string>("WordsId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("VocabularyListVocId");
b.ToTable("Translates");
b.HasData(
new
{
Id = 1L,
VocabularyListVocId = 1L,
WordsId = "1"
});
});
modelBuilder.Entity("Entities.UserEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("ExtraTime")
.HasColumnType("INTEGER");
b.Property<long>("GroupId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("NickName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("TEXT");
b.Property<long>("RoleId")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("image")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("GroupId");
b.HasIndex("RoleId");
b.ToTable("Users");
b.HasData(
new
{
Id = 1L,
Email = "",
ExtraTime = true,
GroupId = 1L,
Name = "name",
NickName = "nickname",
Password = "1234",
RoleId = 1L,
UserName = "username"
},
new
{
Id = 2L,
Email = "",
ExtraTime = true,
GroupId = 1L,
Name = "name2",
NickName = "nickname2",
Password = "1234",
RoleId = 2L,
UserName = "username2"
},
new
{
Id = 3L,
Email = "",
ExtraTime = true,
GroupId = 1L,
Name = "name3",
NickName = "nickname3",
Password = "1234",
RoleId = 3L,
UserName = "username3"
});
});
modelBuilder.Entity("Entities.VocabularyEntity", b =>
{
b.Property<string>("word")
.HasColumnType("TEXT");
b.Property<string>("LangueName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("word");
b.HasIndex("LangueName");
b.ToTable("Vocabularys");
b.HasData(
new
{
word = "Bonjour",
LangueName = "French"
});
});
modelBuilder.Entity("Entities.VocabularyListEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Image")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<long>("UserId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("VocabularyLists");
b.HasData(
new
{
Id = 1L,
Image = "image1",
Name = "Liste1",
UserId = 1L
});
});
modelBuilder.Entity("GroupEntityVocabularyListEntity", b =>
{
b.Property<long>("GroupVocabularyListId")
.HasColumnType("INTEGER");
b.Property<long>("VocsGroupsId")
.HasColumnType("INTEGER");
b.HasKey("GroupVocabularyListId", "VocsGroupsId");
b.HasIndex("VocsGroupsId");
b.ToTable("GroupEntityVocabularyListEntity");
});
modelBuilder.Entity("TranslateEntityVocabularyEntity", b =>
{
b.Property<string>("TransVocword")
.HasColumnType("TEXT");
b.Property<long>("VoctranslationsId")
.HasColumnType("INTEGER");
b.HasKey("TransVocword", "VoctranslationsId");
b.HasIndex("VoctranslationsId");
b.ToTable("TranslateEntityVocabularyEntity");
});
modelBuilder.Entity("Entities.TranslateEntity", b =>
{
b.HasOne("Entities.VocabularyListEntity", "VocabularyListVoc")
.WithMany("translations")
.HasForeignKey("VocabularyListVocId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("VocabularyListVoc");
});
modelBuilder.Entity("Entities.UserEntity", b =>
{
b.HasOne("Entities.GroupEntity", "Group")
.WithMany("Users")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.RoleEntity", "Role")
.WithMany("Users")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Group");
b.Navigation("Role");
});
modelBuilder.Entity("Entities.VocabularyEntity", b =>
{
b.HasOne("Entities.LangueEntity", "Langue")
.WithMany("vocabularys")
.HasForeignKey("LangueName")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Langue");
});
modelBuilder.Entity("Entities.VocabularyListEntity", b =>
{
b.HasOne("Entities.UserEntity", "User")
.WithMany("VocabularyList")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("GroupEntityVocabularyListEntity", b =>
{
b.HasOne("Entities.VocabularyListEntity", null)
.WithMany()
.HasForeignKey("GroupVocabularyListId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.GroupEntity", null)
.WithMany()
.HasForeignKey("VocsGroupsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("TranslateEntityVocabularyEntity", b =>
{
b.HasOne("Entities.VocabularyEntity", null)
.WithMany()
.HasForeignKey("TransVocword")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.TranslateEntity", null)
.WithMany()
.HasForeignKey("VoctranslationsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Entities.GroupEntity", b =>
{
b.Navigation("Users");
});
modelBuilder.Entity("Entities.LangueEntity", b =>
{
b.Navigation("vocabularys");
});
modelBuilder.Entity("Entities.RoleEntity", b =>
{
b.Navigation("Users");
});
modelBuilder.Entity("Entities.UserEntity", b =>
{
b.Navigation("VocabularyList");
});
modelBuilder.Entity("Entities.VocabularyListEntity", b =>
{
b.Navigation("translations");
});
#pragma warning restore 612, 618
}
}
}

@ -0,0 +1,128 @@
using DbContextLib;
using Microsoft.EntityFrameworkCore;
using System.Reflection.Emit;
using Entities;
namespace StubbedContextLib
{
public class StubbedContext : SAEContext
{
//permet la création des données à ajouter dans la base de données
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<UserEntity>().HasData(
new UserEntity
{
Id = 1,
Name = "name",
UserName = "username",
NickName = "nickname",
ExtraTime = true,
GroupId = 1,
Password = "1234",
Email = "",
RoleId = 1
},
new UserEntity
{
Id = 2,
Name = "name2",
UserName = "username2",
NickName = "nickname2",
ExtraTime = true,
GroupId = 1,
Password = "1234",
Email = "",
RoleId = 2
},
new UserEntity
{
Id = 3,
Name = "name3",
UserName = "username3",
NickName = "nickname3",
ExtraTime = true,
GroupId = 1,
Password = "1234",
Email = "",
RoleId = 3,
}
);
modelBuilder.Entity<RoleEntity>().HasData(
new RoleEntity
{
Id = 1,
Name = "Admin"
},
new RoleEntity
{
Id = 2,
Name = "Teacher"
},
new RoleEntity
{
Id = 3,
Name = "Student"
}
);
modelBuilder.Entity<LangueEntity>().HasData(
new LangueEntity
{
name = "French"
},
new LangueEntity
{
name = "English"
}
);
modelBuilder.Entity<GroupEntity>().HasData(
new GroupEntity
{
Id = 1,
Num = 1,
sector = "informatics",
year = 1,
});
modelBuilder.Entity<TranslateEntity>().HasData(
new TranslateEntity
{
Id = 1,
WordsId = "1",
VocabularyListVocId = 1,
VocabularyListVoc = null
});
modelBuilder.Entity<VocabularyEntity>().HasData(
new VocabularyEntity
{
LangueName = "French",
word = "Bonjour"
});
modelBuilder.Entity<VocabularyListEntity>().HasData(
new VocabularyListEntity
{
Id = 1,
Name = "Liste1",
UserId = 1,
Image = "image1",
});
}
public StubbedContext() { }
public StubbedContext(DbContextOptions<SAEContext> options) : base(options)
{
}
}
}

@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DbContext\DbContextLib.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,197 @@
using Entities;
using Microsoft.EntityFrameworkCore;
using StubbedContextLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DbContextLib
{
public class UnitOfWork : IDisposable
{
private bool disposed = false;
private GenericRepository<GroupEntity>? groupRepository;
private GenericRepository<LangueEntity>? langueRepository;
private GenericRepository<RoleEntity>? roleRepository;
private GenericRepository<TranslateEntity>? translateRepository;
private GenericRepository<UserEntity>? userRepository;
private GenericRepository<VocabularyEntity>? vocabularyRepository;
private GenericRepository<VocabularyListEntity>? vocabularyListRepository;
private SAEContext _context { get; set; }
public UnitOfWork(SAEContext context) {
_context = context;
_context.Database.EnsureCreated();
}
public UnitOfWork(StubbedContext context)
{
_context = context;
_context.Database.EnsureCreated();
}
public UnitOfWork(DbContextOptions<SAEContext> options)
: this(new StubbedContext(options))
{
}
public UnitOfWork()
: this(new StubbedContext())
{
}
protected virtual void Dispose(bool disposing)
{
if (!this.disposed && disposing)
{
_context.Dispose();
}
this.disposed = true;
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
public GenericRepository<GroupEntity> GroupRepository
{
get
{
if (groupRepository == null)
{
groupRepository = new GenericRepository<GroupEntity>(_context);
}
return groupRepository;
}
}
public GenericRepository<LangueEntity> LangueRepository
{
get
{
if (langueRepository == null)
{
langueRepository = new GenericRepository<LangueEntity>(_context);
}
return langueRepository;
}
}
public GenericRepository<RoleEntity> RoleRepository
{
get
{
if (roleRepository == null)
{
roleRepository = new GenericRepository<RoleEntity>(_context);
}
return roleRepository;
}
}
public GenericRepository<TranslateEntity> TranslateRepository
{
get
{
if (translateRepository == null)
{
translateRepository = new GenericRepository<TranslateEntity>(_context);
}
return translateRepository;
}
}
public GenericRepository<UserEntity> UserRepository
{
get
{
if (userRepository == null)
{
userRepository = new GenericRepository<UserEntity>(_context);
}
return userRepository;
}
}
public GenericRepository<VocabularyEntity> VocabularyRepository
{
get
{
if (vocabularyRepository == null)
{
vocabularyRepository = new GenericRepository<VocabularyEntity>(_context);
}
return vocabularyRepository;
}
}
public GenericRepository<VocabularyListEntity> VocabularyListRepository
{
get
{
if (vocabularyListRepository == null)
{
vocabularyListRepository = new GenericRepository<VocabularyListEntity>(_context);
}
return vocabularyListRepository;
}
}
public async Task<int> SaveChangesAsync()
{
int result = 0;
try
{
result = await _context.SaveChangesAsync();
}
catch
{
RejectChanges();
return -1;
}
foreach (var entity in _context.ChangeTracker.Entries()
.Where(e => e.State != EntityState.Detached))
{
entity.State = EntityState.Detached;
}
return result;
}
public void RejectChanges()
{
foreach (var entry in _context.ChangeTracker.Entries()
.Where(e => e.State != EntityState.Unchanged))
{
switch (entry.State)
{
case EntityState.Added:
entry.State = EntityState.Detached;
break;
case EntityState.Modified:
case EntityState.Deleted:
entry.Reload();
break;
}
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save