public async Task <IActionResult> Edit(string id, [Bind("PlayerId,Player,PlayerRole,Price")] ChennaiSuperKing chennaiSuperKing) { if (id != chennaiSuperKing.Player) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(chennaiSuperKing); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ChennaiSuperKingExists(chennaiSuperKing.Player)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(chennaiSuperKing)); }
public async Task <IActionResult> Create([Bind("PlayerId,Player,PlayerRole,Price")] ChennaiSuperKing chennaiSuperKing) { if (ModelState.IsValid) { _context.Add(chennaiSuperKing); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(chennaiSuperKing)); }