public async Task <IActionResult> PutEmployee(int id, Employee employee) { if (id != employee.EmployeeId) { return(BadRequest()); } _context.Entry(employee).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("ScheduleId,Title,StartDate,EndDate,DurationHours,RepeatAfterDays,EmployeeId")] Schedule schedule) { if (ModelState.IsValid) { _context.Add(schedule); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(schedule)); }
public async Task <IActionResult> Create([Bind("EmployeeId,Firstname,Lastname")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(employee)); }