public virtual void PromoteTo(EmploymentRole role) { EmploymentRole = role; DomainEvents.Add(new EmployeeWasPromotedEvent { Employee = this }); }
public static Result <Employee> Create(string firstName, string lastName, EmploymentRole role) { var name = EmployeeName.Create(firstName, lastName); if (name.IsFailure) { return(Result.Fail <Employee>(name.Error)); } if (role == null) { return(Result.Fail <Employee>("EmploymentRole cannot be null")); } return(Result.Ok(new Employee(name.Value, role))); }
private Employee(EmployeeName name, EmploymentRole role) : this() { Name = name; EmploymentRole = role; }