예제 #1
0
        public virtual void Hire(Guid id, string name, decimal salary)
        {
            if (State.Id != Guid.Empty)
            {
                throw new InvalidOperationException("A person may only be hired once.");
            }
            if (salary <= 0)
            {
                throw new InvalidOperationException("Negative salaries are not allowed.");
            }

            var employeeHired = new EmployeeHired
            {
                EmployeeId = id,
                Name       = name,
                Salary     = salary,
            };

            Apply(employeeHired);
        }
예제 #2
0
 public void Apply(EmployeeHired evt)
 {
     Id     = evt.EmployeeId;
     Name   = evt.Name;
     Salary = evt.Salary;
 }