public ActionResult Create(Team team) { if (ModelState.IsValid) { db.Teams.Add(team); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.GroupId = new SelectList(db.Groups, "Id", "Name", team.GroupId); ViewBag.GroupMiddleStageId = new SelectList(db.Groups, "Id", "Name", team.GroupMiddleStageId); return View(team); }
public ActionResult Edit(Team team) { if (ModelState.IsValid) { db.Entry(team).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.GroupId = new SelectList(db.Groups, "Id", "Name", team.GroupId); ViewBag.GroupMiddleStageId = new SelectList(db.Groups, "Id", "Name", team.GroupMiddleStageId); return View(team); }