public ActionResult Create(League league) { if (ModelState.IsValid) { _repo.AddLeague(league); return RedirectToAction("Index"); } return View(league); }
/// <summary> /// Create a new League object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="description">Initial value of the Description property.</param> public static League CreateLeague(global::System.Int32 id, global::System.String name, global::System.String description) { League league = new League(); league.Id = id; league.Name = name; league.Description = description; return league; }
/// <summary> /// Deprecated Method for adding a new object to the Leagues EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToLeagues(League league) { base.AddObject("Leagues", league); }
public int AddLeague(League league) { _context.Leagues.Add(league); return Save(); }
public ActionResult Edit(League league) { if (ModelState.IsValid) { db.Entry(league).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(league); }