예제 #1
0
        public ActionConfirmation SaveOrUpdate(Host host)
        {
            if (host.IsValid())
            {
                ValidateHost(host);
                _hostRepository.SaveOrUpdate(host);

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

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

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