示例#1
0
        public ActionResult Create([Bind(Include = "IdRatio,NomRatio")] Ratio ratio)
        {
            if (ModelState.IsValid)
            {
                db.Ratios.Add(ratio);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(ratio));
        }
示例#2
0
        public ActionResult Create([Bind(Include = "IdNiveau,NomNiveau")] Niveau niveau)
        {
            if (ModelState.IsValid)
            {
                db.Niveaux.Add(niveau);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(niveau));
        }
示例#3
0
        public ActionResult Create([Bind(Include = "IdTech,NomTech")] Technologie technologie)
        {
            if (ModelState.IsValid)
            {
                db.Technologies.Add(technologie);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(technologie));
        }
        public ActionResult Create([Bind(Include = "IdQuestion,LibelleQuestion,ReponseType,IdNiveau")] Question question)
        {
            if (ModelState.IsValid)
            {
                db.Questions.Add(question);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.IdNiveau = new SelectList(db.Niveaux, "IdNiveau", "NomNiveau", question.IdNiveau);
            return(View(question));
        }
示例#5
0
        public ActionResult Create([Bind(Include = "IdReponse,LibelleReponse,IdQuestion")] Reponse reponse)
        {
            if (ModelState.IsValid)
            {
                db.Reponses.Add(reponse);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.IdQuestion = new SelectList(db.Questions, "IdQuestion", "LibelleQuestion", reponse.IdQuestion);
            return(View(reponse));
        }
示例#6
0
        public ActionResult Create([Bind(Include = "IdOption,NomOption,NomChoix,IdQuestion,IsGood")] QuestionOption questionOption)
        {
            if (ModelState.IsValid)
            {
                db.QuestionOptions.Add(questionOption);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.IdQuestion = new SelectList(db.Questions, "IdQuestion", "LibelleQuestion", questionOption.IdQuestion);
            return(View(questionOption));
        }
示例#7
0
 /// <summary>
 /// ajouter un candidat
 /// </summary>
 /// <param name="model"></param>
 public void AddNewCandidate(Candidat model)
 {
     //connexion avec dbContext
     using (FilRougeContext dbContext = new FilRougeContext())
     {
         //ajouter à la table candidat le nouveau candidat via le context
         dbContext.Candidats.Add(model);
         dbContext.SaveChanges();
     }
 }
示例#8
0
        public ActionResult <Personne> PostPersonne(Personne personne1)
        {
            _context.Personnes.Add(new Personne {
                Nom = "personne1"
            });
            _context.SaveChanges();
            // _context.Personnes.Add(personne1);
            //await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetPersonne), new { id = personne1.PersonneID }, personne1));
        }
示例#9
0
        public ActionResult CreateQuiz([Bind(Include = "IdQuiz,IdTech,IdNiveau,NbrQuestion")] Quiz quiz)
        {
            if (ModelState.IsValid)
            {
                db.Quizzes.Add(quiz);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.IdTech   = new SelectList(db.Technologies, "IdTech", "NomTech");
            ViewBag.IdNiveau = new SelectList(db.Niveaux, "IdNiveau", "NomTech");

            return(View());
        }
示例#10
0
        /// <summary>
        /// MAJ des réponses du candidat
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateQuizAnswer(Quiz model)
        {
            try
            {
                using (FilRougeContext dbContext = new FilRougeContext())
                {
                    //MAJ le quiz avec les propriétés model
                    Quiz quizToUpdate = dbContext.Quizzes.Find(model.IdQuiz);
                    //sauvegarde de modification
                    dbContext.SaveChanges();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }