Ejemplo n.º 1
0
        public ActionResult UpdatePart8(ps_Group part8)
        {
            bl_QuestionGroup bl_group    = new bl_QuestionGroup();
            bl_Question      bl_question = new bl_Question();

            bl_group.Update(
                part8.Group.QuestionGroupId,
                part8.Group.Paragraph);

            if (ModelState.IsValid)
            {
                foreach (var question in part8.QuestionList)
                {
                    bl_question.Update(
                        question.QuestionId,
                        question.Paragraph,
                        question.OptionA,
                        question.OptionB,
                        question.OptionC,
                        question.OptionD,
                        question.Answer);
                }

                //Trả về trang chủ
                //return Redirect("/");
                part8.Group           = bl_group.GetById(part8.Group.QuestionGroupId);
                part8.Group.Paragraph = HttpUtility.HtmlDecode(part8.Group.Paragraph);
                ViewBag.QuizId        = part8.Group.QuizId;

                //chỉnh lại khi request
                var group        = bl_group.GetById(part8.Group.QuestionGroupId);
                var questionList = bl_question.GetByGroupId(group.QuestionGroupId);
                part8.QuestionList = questionList;

                return(View(part8));
            }
            else
            {
                //Nếu như dữ liệu gởi lên không đạt yêu cầu
                //Trả về client trạng thái dữ liệu đang làm dở
                part8.Group           = bl_group.GetById(part8.Group.QuestionGroupId);
                part8.Group.Paragraph = HttpUtility.HtmlDecode(part8.Group.Paragraph);
                ViewBag.QuizId        = part8.Group.QuizId;

                //chỉnh lại khi request
                var group        = bl_group.GetById(part8.Group.QuestionGroupId);
                var questionList = bl_question.GetByGroupId(group.QuestionGroupId);
                part8.QuestionList = questionList;
                return(View(part8));
            }
        }
Ejemplo n.º 2
0
        public ActionResult UpdatePart6(ps_Group part6)
        {
            bl_QuestionGroup bl_group    = new bl_QuestionGroup();
            bl_Question      bl_question = new bl_Question();

            if (ModelState.IsValid)
            {
                bl_group.Update(
                    part6.Group.QuestionGroupId,
                    part6.Group.Paragraph);

                foreach (var question in part6.QuestionList)
                {
                    bl_question.Update(
                        question.QuestionId,
                        question.Paragraph,
                        question.OptionA,
                        question.OptionB,
                        question.OptionC,
                        question.OptionD,
                        question.Answer);
                }

                part6.Group    = bl_group.GetById(part6.Group.QuestionGroupId);
                ViewBag.QuizId = part6.Group.QuizId;

                //chỉnh lại khi request
                var group        = bl_group.GetById(part6.Group.QuestionGroupId);
                var questionList = bl_question.GetByGroupId(group.QuestionGroupId);
                part6.QuestionList = questionList;

                return(View(part6));
            }
            else
            {
                part6.Group    = bl_group.GetById(part6.Group.QuestionGroupId);
                ViewBag.QuizId = part6.Group.QuizId;

                //chỉnh lại khi request
                var group        = bl_group.GetById(part6.Group.QuestionGroupId);
                var questionList = bl_question.GetByGroupId(group.QuestionGroupId);
                part6.QuestionList = questionList;

                return(View(part6));
            }
        }