public async Task CreateIntegratedEmployeeIfNotExists(LeviathanEmployee employee) { if (await _context.LeviathanEmployees.AnyAsync(e => e.Id == employee.Id)) { return; } await _context.LeviathanEmployees.AddAsync(employee); await _context.SaveChangesAsync(); }
public async Task UpdateEmployee(LeviathanEmployee employee) { var existingEmployee = await _context.LeviathanEmployees.FirstOrDefaultAsync(e => e.Id == employee.Id); if (existingEmployee == null) { throw new DataException($"Employee could not be found: {employee.Id}"); } _context.LeviathanEmployees.Update(employee); await _context.SaveChangesAsync(); }