Beispiel #1
0
        public ActionResult Create(KnockoutMatch knockoutmatch)
        {
            if (ModelState.IsValid)
            {
                _db.KnockoutMatches.Add(knockoutmatch);
                _db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.HomeTeamId = new SelectList(_db.Teams, "Id", "Name", knockoutmatch.HomeTeamId);
            ViewBag.AwayTeamId = new SelectList(_db.Teams, "Id", "Name", knockoutmatch.AwayTeamId);
            return View(knockoutmatch);
        }
Beispiel #2
0
 public ActionResult Edit(KnockoutMatch knockoutmatch)
 {
     if (ModelState.IsValid)
     {
         _db.Entry(knockoutmatch).State = EntityState.Modified;
         _db.SaveChanges();
         return RedirectToAction("Finaler", "Home");
     }
     ViewBag.HomeTeamId = new SelectList(_db.Teams, "Id", "Name", knockoutmatch.HomeTeamId);
     ViewBag.AwayTeamId = new SelectList(_db.Teams, "Id", "Name", knockoutmatch.AwayTeamId);
     return View(knockoutmatch);
 }