Example #1
0
        public ICommandResult Execute(RemoveEmailFromNewsLetterCommand command)
        {
            try
            {
                if (command == null)
                {
                    throw new ArgumentNullException();
                }

                var newsletter = new Newsletter();
                RemoveFromNewsletter(command, newsletter);
                _newsletterRepository.Edit(newsletter);
                _unitOfWork.Commit();
                return(new SuccessResult(NotificationCommandMessage.EmailRemovedFromNewslettersuccessfully));
            }
            catch (Exception exception)
            {
                _logger.Error(exception.Message);
                return(new FailureResult(NotificationCommandMessage.RemovingEmailFromNewsletterFaild));
            }
        }
Example #2
0
        public ActionResult RemoveFromNewsletter(RemoveEmailFromNewsLetterCommand command)
        {
            var result = _commandBus.Send(command);

            return(JsonMessage(result));
        }