예제 #1
0
        public ActionResult Create(Reward reward)
        {
            Campaign campaign = _db.Campaigns.Find(reward.Goal.Campaign.CampaignID);
            if (campaign == null) { return HttpNotFound(); }
            if (campaign.Creator.UserId != (Guid)Membership.GetUser().ProviderUserKey) { return HttpNotFound(); }
            if (ModelState.IsValid)
            {
                _db.Rewards.Add(reward);
                _db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.RewardTypeID = new SelectList(_db.RewardTypes, "RewardTypeID", "Name", reward.RewardTypeID);
            ViewBag.GoalID = new SelectList(_db.Goals.Where(g => g.CampaignID == reward.Goal.CampaignID), "GoalID", "Name", reward.GoalID);
            return View(reward);
        }
예제 #2
0
		private void detach_Rewards(Reward entity)
		{
			this.SendPropertyChanging();
			entity.RewardType = null;
		}
예제 #3
0
		private void attach_Rewards(Reward entity)
		{
			this.SendPropertyChanging();
			entity.RewardType = this;
		}
예제 #4
0
 partial void DeleteReward(Reward instance);
예제 #5
0
 partial void UpdateReward(Reward instance);
예제 #6
0
 partial void InsertReward(Reward instance);
예제 #7
0
		private void detach_Rewards(Reward entity)
		{
			this.SendPropertyChanging();
			entity.UserProfile = null;
		}