public PartialViewResult Edit(ProgramPrimaryKey programPrimaryKey) { var program = programPrimaryKey.EntityObject; var viewModel = new EditViewModel(program); return(ViewEdit(viewModel, program.ProgramPrimaryContactPerson, null)); }
public ActionResult Edit(ProgramPrimaryKey programPrimaryKey, EditViewModel viewModel) { var program = programPrimaryKey.EntityObject; if (!ModelState.IsValid) { return(ViewEdit(viewModel, program.ProgramPrimaryContactPerson, null)); } viewModel.UpdateModel(program, CurrentPerson, false); return(new ModalDialogFormJsonResult()); }
public ActionResult Edit(ProgramPrimaryKey programPrimaryKey, EditViewModel viewModel) { var program = programPrimaryKey.EntityObject; if (!ModelState.IsValid) { return(ViewEdit(viewModel, program.ProgramPrimaryContactPerson, null)); } viewModel.UpdateModel(program, CurrentPerson, false); if (viewModel.ProgramFileResourceData != null) { var currentAgreementFileResource = program.ProgramFileResource; program.ProgramFileResource = null; // Delete old Agreement file, if present if (currentAgreementFileResource != null) { HttpRequestStorage.DatabaseEntities.SaveChanges(); HttpRequestStorage.DatabaseEntities.FileResources.DeleteFileResource(currentAgreementFileResource); } program.ProgramFileResource = FileResource.CreateNewFromHttpPostedFileAndSave(viewModel.ProgramFileResourceData, CurrentPerson); } return(new ModalDialogFormJsonResult()); }