コード例 #1
0
        public ActionConfirmation SaveOrUpdate(SlideFolder slideFolder)
        {
            if (slideFolder.IsValid())
            {
                slideFolderRepository.SaveOrUpdate(slideFolder);

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

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

                return(ActionConfirmation.CreateFailureConfirmation(
                           "The slideFolder could not be saved due to missing or invalid information."));
            }
        }
コード例 #2
0
        public ActionConfirmation UpdateWith(SlideFolder slideFolderFromForm, int idOfSlideFolderToUpdate)
        {
            SlideFolder slideFolderToUpdate =
                slideFolderRepository.Get(idOfSlideFolderToUpdate);

            TransferFormValuesTo(slideFolderToUpdate, slideFolderFromForm);

            if (slideFolderToUpdate.IsValid())
            {
                ActionConfirmation updateConfirmation = ActionConfirmation.CreateSuccessConfirmation(
                    "The slideFolder was successfully updated.");
                updateConfirmation.Value = slideFolderToUpdate;

                return(updateConfirmation);
            }
            else
            {
                slideFolderRepository.DbContext.RollbackTransaction();

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