コード例 #1
0
        public ActionResult ApproveBountyCompletion(Guid id)
        {
            Bounty bounty = this.db.Bounties.Find(id);
            var accountId = this.account.GetLoggedInUserId();

            this.bounty.SetPendingCompletionToFalse(bounty);

            // Add notification message
            this.message.AddBountyNotificationMessage(bounty, "Completion Approved");

            // Send email notification
            this.emailNotificationHelper.SendBountyNotificationEmail(bounty, "Completion Approved");

            IQueryable<WatchedBounty> watchedBounties = this.db.WatchedBounties.Where(b => b.BountyId == bounty.Id);
            WatchedBountyController watchedBountyController = new WatchedBountyController();

            // Remove watched bounty record
            foreach(WatchedBounty watchedBounty in watchedBounties)
            {
                watchedBountyController.UnWatch(watchedBounty.BountyId, watchedBounty.AccountId);
            }

            return RedirectToAction("PendingCompletion");
        }
コード例 #2
0
        public ActionResult CancelBounty(Guid id)
        {
            Bounty bounty = this.db.Bounties.Find(id);
            this.db.Bounties.Remove(bounty);
            this.db.SaveChanges();

            // Send email notification
            this.emailNotificationHelper.SendBountyNotificationEmail(bounty, "Bounty Cancelled");

            // Add notification message
            this.message.AddBountyNotificationMessage(bounty, "Bounty Cancelled");

            IQueryable<WatchedBounty> watchedBounties = this.db.WatchedBounties.Where(b => b.BountyId == bounty.Id);
            WatchedBountyController watchedBountyController = new WatchedBountyController();

            // Remove watched bounty record
            foreach (WatchedBounty watchedBounty in watchedBounties)
            {
                watchedBountyController.UnWatch(watchedBounty.BountyId, watchedBounty.AccountId, "cancelled");
            }

            return RedirectToAction("Dashboard", "Home");
        }