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)); }
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)); } }
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)); } }