public async Task <IActionResult> Edit(int id, [Bind("Id,Name,TeamsNumber")] NationalCup nationalCup) { if (id != nationalCup.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(nationalCup); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NationalCupExists(nationalCup.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(nationalCup)); }
public async Task <IActionResult> Create([Bind("Id,Name,TeamsNumber")] NationalCup nationalCup) { if (ModelState.IsValid) { _context.Add(nationalCup); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(nationalCup)); }