public ActionResult Edit(OwnersTeam ownersteam)
 {
     if (ModelState.IsValid)
     {
         db.OwnersTeams.Attach(ownersteam);
         db.ObjectStateManager.ChangeObjectState(ownersteam, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.TeamID = new SelectList(db.Teams, "TeamID", "Name", ownersteam.TeamID);
     ViewBag.OwnerID = new SelectList(db.Owners, "OwnerID", "OwnerNames", ownersteam.OwnerID);
     return View(ownersteam);
 }
        public ActionResult Create(OwnersTeam ownersteam)
        {
            if (ModelState.IsValid)
            {
                db.OwnersTeams.AddObject(ownersteam);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.TeamID = new SelectList(db.Teams, "TeamID", "Name", ownersteam.TeamID);
            ViewBag.OwnerID = new SelectList(db.Owners, "OwnerID", "OwnerNames", ownersteam.OwnerID);
            return View(ownersteam);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the OwnersTeams EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToOwnersTeams(OwnersTeam ownersTeam)
 {
     base.AddObject("OwnersTeams", ownersTeam);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Create a new OwnersTeam object.
 /// </summary>
 /// <param name="ownerID">Initial value of the OwnerID property.</param>
 /// <param name="teamID">Initial value of the TeamID property.</param>
 /// <param name="fromDate">Initial value of the FromDate property.</param>
 public static OwnersTeam CreateOwnersTeam(global::System.Int32 ownerID, global::System.Int32 teamID, global::System.DateTime fromDate)
 {
     OwnersTeam ownersTeam = new OwnersTeam();
     ownersTeam.OwnerID = ownerID;
     ownersTeam.TeamID = teamID;
     ownersTeam.FromDate = fromDate;
     return ownersTeam;
 }