Ejemplo n.º 1
0
        public async Task <IActionResult> Index()
        {
            ProfesseurViewModel mymodel = new ProfesseurViewModel();

            mymodel.Professeurs = await _context.Professeur.ToListAsync();

            mymodel.Matieres = _context.Matiere.ToList();
            return(View(mymodel));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        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));
        }