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