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