Example #1
0
        public ActionResult Activate(Guid id)
        {
            // Get the campaign.

            var campaign = _campaignsQuery.GetCampaign(id);

            if (campaign == null)
            {
                return(NotFound("campaign", "id", id));
            }

            // Update its status.

            _campaignsCommand.UpdateStatus(campaign, CampaignStatus.Activated);
            return(View("Status", campaign));
        }
Example #2
0
        private void UpdateStatus(IEnumerable <Campaign> campaigns, CampaignStatus status)
        {
            const string method = "UpdateStatus";

            foreach (var campaign in campaigns)
            {
                try
                {
                    _eventSource.Raise(Event.Information, method, string.Format("Setting the status for the {0} campaign to {1}...", campaign.Name, status));
                    _campaignsCommand.UpdateStatus(campaign, status);
                }
                catch (Exception ex)
                {
                    _eventSource.Raise(Event.Error, method, string.Format("Failed to update the status for the '{0}' campaign to {1}.", campaign.Name, status), ex, new StandardErrorHandler());
                }
            }
        }