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