コード例 #1
0
        public PartialViewResult Edit(ProgramPrimaryKey programPrimaryKey)
        {
            var program   = programPrimaryKey.EntityObject;
            var viewModel = new EditViewModel(program);

            return(ViewEdit(viewModel, program.ProgramPrimaryContactPerson, null));
        }
コード例 #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);
            return(new ModalDialogFormJsonResult());
        }
コード例 #3
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());
        }