Example #1
0
        public ActionConfirmation SaveOrUpdate(ChannelsSlide channelsSlide)
        {
            if (channelsSlide.IsValid())
            {
                channelsSlideRepository.SaveOrUpdate(channelsSlide);

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

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

                return(ActionConfirmation.CreateFailureConfirmation(
                           "The channelsSlide could not be saved due to missing or invalid information."));
            }
        }
Example #2
0
        public ActionConfirmation UpdateWith(ChannelsSlide channelsSlideFromForm, int idOfChannelsSlideToUpdate)
        {
            ChannelsSlide channelsSlideToUpdate =
                channelsSlideRepository.Get(idOfChannelsSlideToUpdate);

            TransferFormValuesTo(channelsSlideToUpdate, channelsSlideFromForm);

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

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

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