public async Task Handle(EmployeeAssignedToLocationEvent message) { var location = await _locationRepository.GetByID(message.NewLocationID); location.Employees.Add(message.EmployeeID); await _locationRepository.Save(location); var employee = await _employeeRepository.GetByID(message.EmployeeID); employee.LocationID = message.NewLocationID; await _employeeRepository.Save(employee); }
public void Handle(EmployeeAssignedToLocationEvent message) { var location = _locationRepo.GetByID(message.NewLocationID); location.Employees.Add(message.EmployeeID); _locationRepo.Save(location); //Find the employee which was assigned to this Location var employee = _employeeRepo.GetByID(message.EmployeeID); employee.LocationID = message.NewLocationID; _employeeRepo.Save(employee); }
public Task Handle(EmployeeAssignedToLocationEvent message) { var location = _locationRepository.GetByID(message._locationId); location.Employees.Add(message._employeeId); _locationRepository.Save(location); //Find the employee which was assigned to this Location var employee = _employeeRepository.GetByID(message._employeeId); employee.LocationID = message._locationId; _employeeRepository.Save(employee); return(Task.CompletedTask); }
private void Apply(EmployeeAssignedToLocationEvent e) { _employees.Add(e.EmployeeId); }