public void RaiseSalary(EmployeeId id, decimal amount) { _store.DatabaseCommands.Patch($"employees/{id}", new ScriptedPatchRequest { Script = $"this.Salary += {amount.ToInvariantString()};" }); }
public RaiseEmployeeSalaryCommand( EmployeeId id, decimal amount ) : base(id) { Amount = amount; }
public EmployeeSalaryRaisedEvent( EmployeeId employeeId, decimal amount ) : base(employeeId) { Amount = amount; }
public Employee Load(EmployeeId id) { using (var session = _store.OpenSession()) { return session.Load<Employee>($"employees/{id}"); } }
public RegisterEmployeeCommand( EmployeeId id, FullName name, decimal initialSalary ) : base(id) { Name = name; InitialSalary = initialSalary; }
public EmployeeRegisteredEvent( EmployeeId employeeId, FullName name, decimal initialSalary ) : base(employeeId) { Name = name; InitialSalary = initialSalary; }
public void UpdateHomeAddress(EmployeeId id, Address homeAddress) { var employee = _data[id]; _data[id] = new Employee( employee.Id, employee.Name, homeAddress, employee.Salary ); }
public void RaiseSalary(EmployeeId id, decimal amount) { var employee = _data[id]; _data[id] = new Employee( employee.Id, employee.Name, employee.HomeAddress, employee.Salary + amount ); }
public void CreateEmployee(EmployeeId id, FullName name, decimal initialSalary) { using (var session = _store.OpenSession()) { var employee = new Employee(id, name, Address.NotInformed, initialSalary ); session.Store(employee); session.SaveChanges(); } }
public void UpdateHomeAddress(EmployeeId id, Address homeAddress) { var ro = RavenJObject.FromObject(homeAddress, _serializer); _store.DatabaseCommands.Patch($"employees/{id}", new[] { new PatchRequest { Type = PatchCommandType.Set, Name = "HomeAddress", Value = ro } }); }
protected EmployeeEvent(EmployeeId employeeId) { EmployeeId = employeeId; }
protected EmployeeCommand(EmployeeId id) { Id = id; }
public void CreateEmployee(EmployeeId id, FullName name, decimal initialSalary) { _data.Add(id, new Employee(id, name, Address.NotInformed, initialSalary)); }
public bool IsRegistered(EmployeeId id) { var lid = $"employees/{id}"; return _store.DatabaseCommands.Head(lid) != null; }
public bool IsRegistered(EmployeeId id) { return (_data.ContainsKey(id)); }
public FailedToRegisterEmployeeEvent(EmployeeId employeeId) : base(employeeId) {}
public Employee Load(EmployeeId id) { return _data[id]; }