public async Task <IActionResult> Edit(int id, [Bind("Id,Name,YearBirth,Information,CountryId")] GenManagers genManagers) { if (id != genManagers.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(genManagers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GenManagersExists(genManagers.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CountryId"] = new SelectList(_context.Countries, "Id", "Id", genManagers.CountryId); return(View(genManagers)); }
public async Task <IActionResult> Create([Bind("Id,Name,YearBirth,Information,CountryId")] GenManagers genManagers) { if (ModelState.IsValid) { _context.Add(genManagers); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CountryId"] = new SelectList(_context.Countries, "Id", "Id", genManagers.CountryId); return(View(genManagers)); }