public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Profession profession) { if (id != profession.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(profession); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProfessionExists(profession.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(profession)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,BeginDate,EndDate,TraineeId")] Traineeship traineeship) { if (id != traineeship.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(traineeship); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TraineeshipExists(traineeship.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["TraineeId"] = new SelectList(_context.Trainees, "Id", "Id", traineeship.TraineeId); return(View(traineeship)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName")] Trainee trainee) { if (id != trainee.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(trainee); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TraineeExists(trainee.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(trainee)); }