public ActionResult Edit(SponsorsTeam sponsorsteam)
 {
     if (ModelState.IsValid)
     {
         db.SponsorsTeams.Attach(sponsorsteam);
         db.ObjectStateManager.ChangeObjectState(sponsorsteam, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.TeamID = new SelectList(db.Teams, "TeamID", "Name", sponsorsteam.TeamID);
     ViewBag.SponsorID = new SelectList(db.Sponsors, "SponsorID", "Name", sponsorsteam.SponsorID);
     return View(sponsorsteam);
 }
        public ActionResult Create(SponsorsTeam sponsorsteam)
        {
            if (ModelState.IsValid)
            {
                db.SponsorsTeams.AddObject(sponsorsteam);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.TeamID = new SelectList(db.Teams, "TeamID", "Name", sponsorsteam.TeamID);
            ViewBag.SponsorID = new SelectList(db.Sponsors, "SponsorID", "Name", sponsorsteam.SponsorID);
            return View(sponsorsteam);
        }
예제 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the SponsorsTeams EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSponsorsTeams(SponsorsTeam sponsorsTeam)
 {
     base.AddObject("SponsorsTeams", sponsorsTeam);
 }
예제 #4
0
 /// <summary>
 /// Create a new SponsorsTeam object.
 /// </summary>
 /// <param name="sponsorID">Initial value of the SponsorID property.</param>
 /// <param name="teamID">Initial value of the TeamID property.</param>
 /// <param name="fromDate">Initial value of the FromDate property.</param>
 public static SponsorsTeam CreateSponsorsTeam(global::System.Int32 sponsorID, global::System.Int32 teamID, global::System.DateTime fromDate)
 {
     SponsorsTeam sponsorsTeam = new SponsorsTeam();
     sponsorsTeam.SponsorID = sponsorID;
     sponsorsTeam.TeamID = teamID;
     sponsorsTeam.FromDate = fromDate;
     return sponsorsTeam;
 }