コード例 #1
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));
            }
        }