Exemplo n.º 1
0
        public ActionResult NewAgreement(AgreementEditViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(AgreementViewEdit(viewModel, CurrentFirmaSession, null));
            }

            var agreement = new Agreement(false, false, viewModel.ContractTypeID.Value);

            viewModel.UpdateModelAndSaveChanges(agreement, CurrentFirmaSession, HttpRequestStorage.DatabaseEntities);

            SetMessageForDisplay($"Agreement {agreement.GetDetailLinkUsingAgreementNumber()} successfully created.");

            return(new ModalDialogFormJsonResult());
        }
Exemplo n.º 2
0
        public ActionResult EditBasics(AgreementPrimaryKey agreementPrimaryKey, AgreementEditViewModel viewModel)
        {
            var agreement = agreementPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(AgreementViewEdit(viewModel, CurrentFirmaSession, agreement));
            }

            viewModel.UpdateModelAndSaveChanges(agreement, CurrentFirmaSession, HttpRequestStorage.DatabaseEntities);

            SetMessageForDisplay($"Agreement {agreement.GetDetailLinkUsingAgreementNumber()} saved.");

            // They may have edited the Agreement Number, so we need to redirect in case this has happened.
            string redirectUrl = SitkaRoute <AgreementController> .BuildAbsoluteUrlHttpsFromExpression(x => x.AgreementDetail(viewModel.AgreementNumber));

            return(new ModalDialogFormJsonResult(redirectUrl));
        }