示例#1
0
        public ActionResult Delete(int?assessmentQuestionPK)
        {
            IAssessmentQuestionsRepository assessmentQuestionsRepository = new AssessmentQuestionsRepository(db);

            if (assessmentQuestionPK != null)
            {
                AssessmentQuestion assessmentQuestion = assessmentQuestionsRepository.GetAssessmentQuestionByPK((int)assessmentQuestionPK);

                assessmentQuestion.Deleted = true;

                assessmentQuestionsRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("DELETE", assessmentQuestion.AssessmentQuestionPK);
            }

            return(Redirect(Request.UrlReferrer.AbsoluteUri));
        }
示例#2
0
        public ActionResult Edit(AssessmentQuestionView assessmentQuestionView, FormCollection form)
        {
            if (ModelState.IsValid)
            {
                IAssessmentQuestionsRepository assessmentQuestionsRepository = new AssessmentQuestionsRepository(db);
                AssessmentQuestion             assessmentQuestion            = assessmentQuestionsRepository.GetAssessmentQuestionByPK((int)assessmentQuestionView.AssessmentQuestionPK);

                assessmentQuestionView.ConvertTo(assessmentQuestionView, assessmentQuestion);

                assessmentQuestionsRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("UPDATE", assessmentQuestion.AssessmentQuestionPK);

                return(RedirectToAction("Index", "AssessmentQuestion"));
            }
            else
            {
                assessmentQuestionView.BindDDLs(assessmentQuestionView, db);

                return(View(assessmentQuestionView));
            }
        }