public async Task <ActionResult <Employee> > PostEmployee(Employee employee) { _context.Employee.Add(employee); await _context.SaveChangesAsync(); return(employee); }
public async Task <IActionResult> PutDependent(int id, Dependent dependent) { if (id != dependent.ID) { return(BadRequest()); } _context.Entry(dependent).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DependentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Employee> > PostEmployee(Employee employee) { _context.Employee.Add(employee); await _context.SaveChangesAsync(); return(CreatedAtAction("GetEmployee", new { id = employee.ID }, employee)); }