Exemple #1
0
 public ActionResult Edit(Sports sports)
 {
     if (ModelState.IsValid)
     {
         db.SportsSet.Attach(sports);
         db.ObjectStateManager.ChangeObjectState(sports, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(sports);
 }
Exemple #2
0
        public ActionResult Create(Sports sports)
        {
            if (ModelState.IsValid)
            {
                db.SportsSet.AddObject(sports);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(sports);
        }
Exemple #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the SportsSet EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSportsSet(Sports sports)
 {
     base.AddObject("SportsSet", sports);
 }
Exemple #4
0
 /// <summary>
 /// Create a new Sports object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 public static Sports CreateSports(global::System.Int32 id, global::System.String name)
 {
     Sports sports = new Sports();
     sports.Id = id;
     sports.Name = name;
     return sports;
 }