Exemplo n.º 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));
        }
Exemplo n.º 2
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));
            }
        }
Exemplo n.º 3
0
        public ActionResult Add(AssessmentTypeView assessmentTypeView)
        {
            if (ModelState.IsValid)
            {
                IAssessmentTypesRepository assessmentTypesRepository = new AssessmentTypesRepository(db);
                AssessmentType             assessmentType            = new AssessmentType();

                assessmentTypeView.ConvertTo(assessmentTypeView, assessmentType);

                assessmentTypesRepository.Add(assessmentType);
                assessmentTypesRepository.SaveChanges();

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

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