public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Entities.ItCompany itCompany) { if (id != itCompany.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(itCompany); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ItCompanyExists(itCompany.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(itCompany)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Department department) { if (id != department.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(department); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepartmentExists(department.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(department)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,LastName,BornDate")] Employee employee) { if (id != employee.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(employee); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(employee.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(employee)); }