예제 #1
0
        public ActionResult Delete(int?assessmentTypePK)
        {
            IAssessmentTypesRepository assessmentTypesRepository = new AssessmentTypesRepository(db);

            if (assessmentTypePK != null)
            {
                AssessmentType assessmentType = assessmentTypesRepository.GetAssessmentTypeByPK((int)assessmentTypePK);

                assessmentType.Deleted = true;

                assessmentTypesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("DELETE", assessmentType.AssessmentTypePK);
            }

            return(Redirect(Request.UrlReferrer.AbsoluteUri));
        }
예제 #2
0
        public ActionResult Edit(int?assessmentTypePK)
        {
            if (assessmentTypePK != null)
            {
                IAssessmentTypesRepository assessmentTypesRepository = new AssessmentTypesRepository(db);
                AssessmentType             assessmentType            = assessmentTypesRepository.GetAssessmentTypeByPK((int)assessmentTypePK);
                AssessmentTypeView         assessmentTypeView        = new AssessmentTypeView();

                assessmentTypeView.ConvertFrom(assessmentType, assessmentTypeView);

                return(View(assessmentTypeView));
            }
            else
            {
                return(RedirectToAction("Index", "AssessmentType"));
            }
        }
예제 #3
0
        public ActionResult Edit(AssessmentTypeView assessmentTypeModel)
        {
            if (ModelState.IsValid)
            {
                IAssessmentTypesRepository assessmentTypesRepository = new AssessmentTypesRepository(db);
                AssessmentType             assessmentType            = assessmentTypesRepository.GetAssessmentTypeByPK((int)assessmentTypeModel.AssessmentTypePK);
                assessmentTypeModel.ConvertTo(assessmentTypeModel, assessmentType);

                assessmentTypesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("UPDATE", assessmentType.AssessmentTypePK);

                return(RedirectToAction("Index", "AssessmentType"));
            }
            else
            {
                return(View(assessmentTypeModel));
            }
        }