コード例 #1
0
        public ActionConfirmation SaveOrUpdate(Agency agency)
        {
            if (agency.IsValid())
            {
                ValidateAgency(agency);
                _agencyRepository.SaveOrUpdate(agency);

                ActionConfirmation saveOrUpdateConfirmation = ActionConfirmation.CreateSuccessConfirmation(
                    "The agency was successfully saved.");
                saveOrUpdateConfirmation.Value = agency;

                return(saveOrUpdateConfirmation);
            }
            else
            {
                _agencyRepository.DbContext.RollbackTransaction();

                return(ActionConfirmation.CreateFailureConfirmation(
                           "The agency could not be saved due to missing or invalid information."));
            }
        }