public async Task <IActionResult> Index() { ProfesseurViewModel mymodel = new ProfesseurViewModel(); mymodel.Professeurs = await _context.Professeur.ToListAsync(); mymodel.Matieres = _context.Matiere.ToList(); return(View(mymodel)); }
public async Task <IActionResult> Edit(int?id) { if (id == null) { return(NotFound()); } ProfesseurViewModel mymodel = new ProfesseurViewModel(); mymodel.Professeur = await _context.Professeur.FindAsync(id); mymodel.Matieres = _context.Matiere.ToList(); if (mymodel.Professeur == null) { return(NotFound()); } return(View(mymodel)); }
public async Task <IActionResult> Delete(int?id) { if (id == null) { return(NotFound()); } ProfesseurViewModel mymodel = new ProfesseurViewModel(); mymodel.Professeur = await _context.Professeur .FirstOrDefaultAsync(m => m.IdProfesseur == id); mymodel.Matieres = _context.Matiere.ToList(); if (mymodel.Professeur == null) { return(NotFound()); } return(View(mymodel)); }
public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } ProfesseurViewModel mymodel = new ProfesseurViewModel(); mymodel.Professeur = await _context.Professeur .FirstOrDefaultAsync(m => m.IdProfesseur == id); mymodel.LibelleMatiere = _context.Classe.Find(mymodel.Professeur.MatiereId).Libelle; if (mymodel.Professeur == null) { return(NotFound()); } return(View(mymodel)); }