public ActionResult Edit(TreatmentBMPAssessmentObservationTypePrimaryKey treatmentBMPAssessmentObservationTypePrimaryKey, EditViewModel viewModel) { var treatmentBMPAssessmentObservationType = treatmentBMPAssessmentObservationTypePrimaryKey.EntityObject; if (!ModelState.IsValid) { return(ViewEdit(viewModel, treatmentBMPAssessmentObservationType)); } viewModel.UpdateModel(treatmentBMPAssessmentObservationType, CurrentPerson); return(RedirectToAction(new SitkaRoute <TreatmentBMPAssessmentObservationTypeController>(c => c.Detail(treatmentBMPAssessmentObservationType.PrimaryKey)))); }
public ActionResult New(EditViewModel viewModel) { if (!ModelState.IsValid) { return(ViewEdit(viewModel, null)); } var treatmentBMPAssessmentObservationType = new TreatmentBMPAssessmentObservationType(String.Empty, ObservationTypeSpecification.PassFail_PassFail_None, String.Empty); viewModel.UpdateModel(treatmentBMPAssessmentObservationType, CurrentPerson); HttpRequestStorage.DatabaseEntities.TreatmentBMPAssessmentObservationTypes.Add(treatmentBMPAssessmentObservationType); HttpRequestStorage.DatabaseEntities.SaveChanges(); SetMessageForDisplay($"Observation Type {treatmentBMPAssessmentObservationType.TreatmentBMPAssessmentObservationTypeName} succesfully created."); return(RedirectToAction(new SitkaRoute <TreatmentBMPAssessmentObservationTypeController>(c => c.Detail(treatmentBMPAssessmentObservationType.PrimaryKey)))); }