Exemplo n.º 1
0
 public virtual void PromoteTo(EmploymentRole role)
 {
     EmploymentRole = role;
     DomainEvents.Add(new EmployeeWasPromotedEvent {
         Employee = this
     });
 }
Exemplo n.º 2
0
        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)));
        }
Exemplo n.º 3
0
 private Employee(EmployeeName name, EmploymentRole role) : this()
 {
     Name           = name;
     EmploymentRole = role;
 }