public async Task <IActionResult> Edit(int id, [Bind("ScheduleId,Title,StartDate,EndDate,DurationHours,RepeatAfterDays,EmployeeId")] Schedule schedule) { if (id != schedule.ScheduleId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(schedule); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException ex) { if (!ScheduleExists(schedule.ScheduleId)) { return(NotFound()); } throw ex; } return(RedirectToAction(nameof(Index))); } return(View(schedule)); }
public async Task <IActionResult> Edit(int id, [Bind("EmployeeId,Firstname,Lastname")] Employee employee) { if (id != employee.EmployeeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(employee); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException ex) { if (!EmployeeExists(employee.EmployeeId)) { return(NotFound()); } throw ex; } return(RedirectToAction(nameof(Index))); } return(View(employee)); }