//[ValidateAntiForgeryToken] public async Task <IActionResult> Edit(int id, Language language) { if (id != language.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(language); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LanguageExists(language.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(language)); }
//[ValidateAntiForgeryToken] public async Task <IActionResult> Edit(int id, Worker worker) { if (id != worker.Id) { return(NotFound()); } if (ModelState.IsValid) { worker.Department = await _context.Departments.FindAsync(worker.Department.Id); worker.Language = await _context.Languages.FindAsync(worker.Language.Id); try { _context.Update(worker); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WorkerExists(worker.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } AddTablesInViewBag(); return(View(worker)); }