コード例 #1
0
 public ActionResult Edit([Bind(Include = "TypeQuestionId,NameType")] TypeQuestion typeQuestion)
 {
     if (ModelState.IsValid)
     {
         db.Entry(typeQuestion).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(typeQuestion));
 }
コード例 #2
0
        /// <summary>
        /// Edition d'un type de question
        /// </summary>
        /// <param name="typeQuestion"></param>
        /// <returns></returns>
        public TypeQuestion EditTypeQuestion(TypeQuestion typeQuestion)
        {
            using (var dbContext = new FilRougeDBContext())
            {
                dbContext.Entry(typeQuestion).State = EntityState.Modified;
                dbContext.SaveChanges();
            }

            return(typeQuestion);
        }
コード例 #3
0
        /// <summary>
        /// Edition d'une technologie par son "Id"
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Technology EditTechnology(Technology technology)
        {
            var technolgie = new Technology();

            using (var dbContext = new FilRougeDBContext())
            {
                dbContext.Entry(technology).State = EntityState.Modified;
                dbContext.SaveChanges();
            }

            return(technolgie);
        }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "DifficultyMasterId,DifficultyId,Rate")] DifficultyRate difficultyRate)
 {
     if (ModelState.IsValid)
     {
         db.Entry(difficultyRate).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DifficultyId       = new SelectList(db.Difficulties, "DifficultyId", "DifficultyName", difficultyRate.DifficultyId);
     ViewBag.DifficultyMasterId = new SelectList(db.Difficulties, "DifficultyId", "DifficultyName", difficultyRate.DifficultyMasterId);
     return(View(difficultyRate));
 }
コード例 #5
0
        public int EditDifficulty(DifficultyMasterViewModel difficultyViewModel)
        {
            var id = 0;

            using (var dbContext = new FilRougeDBContext())
            {
                var difficulty = dbContext.Difficulties.Find(difficultyViewModel.DiffMasterId);
                difficulty.DifficultyId           = difficultyViewModel.DiffMasterId;
                difficulty.DifficultyName         = difficultyViewModel.DiffMasterName;
                dbContext.Entry(difficulty).State = EntityState.Modified;
                dbContext.SaveChanges();
                id = difficulty.DifficultyId;
            }
            return(id);
        }
コード例 #6
0
        public int EditQuizz(QuizzViewModel quizzViewModel)
        {
            int id = 0;

            using (var db = new FilRougeDBContext())
            {
                var quizz = db.Quizz.Find(quizzViewModel.QuizzId);

                quizz.NomUser    = quizzViewModel.NomUser;
                quizz.PrenomUser = quizzViewModel.PrenomUser;

                db.Entry(quizz).State = EntityState.Modified;
                db.SaveChanges();

                id = quizz.QuizzId;
            }
            return(id);
        }
コード例 #7
0
        /// <summary>
        /// Edition d'une question
        /// </summary>
        /// <param name="questionViewModel"></param>
        /// <returns></returns>
        public int EditQuestion(QuestionViewModel questionViewModel)
        {
            var id = 0;

            using (var dbContext = new FilRougeDBContext())
            {
                var question = dbContext.Questions.Find(questionViewModel.QuestionId);
                question.Commentaire    = questionViewModel.Commentaire;
                question.Content        = questionViewModel.Content;
                question.Active         = questionViewModel.Active;
                question.DifficultyId   = questionViewModel.Difficulty.DifficultyId;
                question.QuestionTypeId = questionViewModel.QuestionType.TypeQuestionId;
                question.TechnologyId   = questionViewModel.Technology.TechnoId;

                dbContext.Entry(question).State = EntityState.Modified;
                dbContext.SaveChanges();

                id = question.QuestionId;
            }

            return(id);
        }