public async Task <IActionResult> Edit(Guid id, [Bind("Id,Name,Trophy,Year")] ChampionshipEntity championshipEntity) { if (id != championshipEntity.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(championshipEntity); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ChampionshipEntityExists(championshipEntity.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(championshipEntity)); }
public async Task <IActionResult> Create([Bind("Id,Name,Trophy,Year")] ChampionshipEntity championshipEntity) { if (ModelState.IsValid) { championshipEntity.Id = Guid.NewGuid(); _context.Add(championshipEntity); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(championshipEntity)); }
public abstract Task CreateAsync(ChampionshipEntity entity, CancellationToken cancellationToken = default);