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());
        }
Example #2
0
        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());
        }