I'm trying to do a little personnal project, and I want to translate this uml class diagram into several class with the foreign key, primary key and so on.
![enter image description here]()
But when I want to create a razor page (CRUD) I have this error:
![enter image description here]()
I want to create it inside a folder, which is "Seances".
NB: I do not know how to use correctly the foreign key, my error is obviously from there...
Those are inside a Model folder.
Sorry its write in french, but here is a fast translate: Batiment = building
Salle = classroom
Seance = class session
UE = school subject (like math, english, IT class...)
Groupe = Group
Type Seance = kind of class session (CM = when all the class is here, TD = small group of the class in a classroom, TP = computer classroom for example)
Here is a total view of my project with the CRUD menu.
![enter image description here]()
Here are my .cs file :
Batiment.cs
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel.DataAnnotations;usingSystem.Linq;usingSystem.Threading.Tasks;namespaceProjetAsi.Models{publicclassBatiment{//Primary keypublicintIdBatiment{get;set;}[Required]publicstringNomBatiment{get;set;}//Navigation link toward "salles"publicICollection<Salle>LesSalles{get;set;}}}
Salle.cs
namespaceProjetAsi.Models{publicclassSalle{//Primary keypublicintIdSalle{get;set;}[Required]publicstringNomSalle{get;set;}//foreign key for "batiment"publicint?IdBatiment{get;set;}//Navigation link toward séances publicICollection<Seance>LesSeances{get;set;}//Navigation link toward batimentpublicBatimentLeBatiment{get;set;}}}
Seance.cs
namespaceProjetAsi.Models{publicclassSeance{//Primary keypublicintIdSeance{get;set;}[Required]publicDateTimeJourSeance{get;set;}[Required]publicDateTimeHeureDebut{get;set;}[Required]publicintDureeSeance{get;set;}//foreign key for Salle publicint?IdSalle{get;set;}//foreign key for UE publicint?IdUE{get;set;}//Navigation link toward groupes publicICollection<Groupe>LesGroupes{get;set;}//Navigation link toward UEpublicICollection<UE> LUE {get;set;}//Navigation link toward group 0 or 1 publicICollection<Groupe>LeGroupe{get;set;}//Navigation link toward sallespublicICollection<Salle>LesSalles{get;set;}}}
TypeSeance.cs
namespaceProjetAsi.Models{publicclassTypeSeance{publicenumEnumTypeSeance{
CM, TD, TP}//Primary keypublicintIdTypeSeance{get;set;}[Required]publicEnumTypeSeanceIntituleTypeSeance{get;set;}//Navigation link toward séancespublicICollection<Seance>LesSeances{get;set;}}}
UE.cs
namespaceProjetAsi.Models{publicclass UE{//Primary keypublicintIdUE{get;set;}[Required]publicstringNumeroUE{get;set;}[Required]publicstringIntituleUE{get;set;}//Navigation link toward GroupepublicICollection<Groupe>LesGroupes{get;set;}//Navigation link toward SeancepublicICollection<Seance>LesSeance{get;set;}}}
Groupe.cs
namespaceProjetAsi.Models{publicclassGroupe{//Primary keypublicintIdGroupe{get;set;}[Required]publicstringNomGroupe{get;set;}//foreign key for UE publicint?IdUE{get;set;}//foreign key for Seance publicint?IdSeance{get;set;}}}
Cordially