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