Пример #1
0
        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);
        }
Пример #2
0
 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);
 }