Esempio n. 1
0
        public static void InsertDemande(Demande de)
        {
            using (var context = new LibraryContext())
            {
                // Creates the database if not exists
                context.Database.EnsureCreated();

                if (de.checkDemande() == 0)
                {
                    //context.demande.First(b=>b.apoge==de.company)
                    // Adds admins
                    context.demande.Add(new Demande
                    {
                        intern_supervisor = de.intern_supervisor,
                        extern_supervisor = de.extern_supervisor,
                        company           = de.company,
                        idStudent         = de.idStudent
                    });


                    // Saves changes
                    context.SaveChanges();
                }
            }
        }
        public IActionResult Demande()
        {
            Console.WriteLine("from Demande function " + StudentController.apoge);
            Console.WriteLine("from Demande function viewData " + ViewData["apoge"]);
            Demande dd = new Demande();

            dd.idStudent = StudentController.apoge;
            if (dd.checkDemande() == 1)
            {
                ViewData["button"] = "disabled";
            }
            return(View());
        }