コード例 #1
0
ファイル: CampaignsController.cs プロジェクト: formist/LinkMe
        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));
        }
コード例 #2
0
ファイル: CampaignsTask.cs プロジェクト: formist/LinkMe
        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());
                }
            }
        }