コード例 #1
0
        public ActionResult AddUser(string Name, string Email, string NE)
        //public ActionResult Inscription(InfoInscription info)
        {
            InfoInscription info = new InfoInscription();

            info.Nom       = Name;
            info.Email     = Email;
            info.Education = NE;
            var username = GenererUsername(info);
            var pwd      = GenererPwd(info);

            Email email  = new Email(info, username, pwd);
            bool  status = sendMail(email);

            if (status)
            {
                niveauEducationDataClassesDataContext db = new niveauEducationDataClassesDataContext();
                Inscription eleve = new Inscription {
                    nom = Name, email = Email, education = NE
                };
                db.Inscriptions.InsertOnSubmit(eleve);
                db.SubmitChanges();
                credential cr = new credential {
                    username = username, password = pwd, email = Email, firsttime = 1
                };
                db.credentials.InsertOnSubmit(cr);
                db.SubmitChanges();
            }
            return(View("inscription"));
        }
コード例 #2
0
        public ActionResult AddCours(string Title, string Education, string Chapters, string Date, string Description, string Image)
        {
            niveauEducationDataClassesDataContext db = new niveauEducationDataClassesDataContext();
            Cour c1 = new Cour {
                idprof = Convert.ToInt32(Session["id"]), titre = Title, niveaueducation = Education, chapitres = Chapters,
                date   = Date, description = Description, image = Image
            };                                              //fetch IDPROF

            db.Cours.InsertOnSubmit(c1);
            db.SubmitChanges();

            return(View("AddCourse"));
        }
コード例 #3
0
        public ActionResult Course2(string coursid)
        {
            niveauEducationDataClassesDataContext bd = new niveauEducationDataClassesDataContext();
            EleveCour e1 = new EleveCour {
                ideleve = Convert.ToInt32(Session["id"]), idcours = Convert.ToInt32(coursid)
            };

            bd.EleveCours.InsertOnSubmit(e1);
            bd.SubmitChanges();
            var listeCours = (from cours in bd.EleveCours
                              where cours.ideleve == Convert.ToInt32(Session["id"])
                              select cours.Cour);

            ViewBag.listeCours = listeCours;
            return(View("MyCourses"));
        }
コード例 #4
0
        public ActionResult first(string username, string password)
        {
            niveauEducationDataClassesDataContext db = new niveauEducationDataClassesDataContext();
            var compte = (from cmpt in db.credentials
                          where cmpt.username == Session["username"].ToString() && cmpt.password == Session["password"].ToString()
                          select cmpt);

            foreach (var cmpt in compte)
            {
                cmpt.username  = username;
                cmpt.password  = password;
                cmpt.firsttime = 0;
                db.SubmitChanges();
            }
            return(View("accueil"));
        }