public void RequestAbsence([FromBody] RequestApprovment request) { var userName = SecurityInfo.GetUserIdentity(User); var requestId = request.HumanResourcesRequestId; var isApproved = request.IsApproved; var command = new RequestApprovmentCommand( userName, requestId, isApproved, userName); _bus.Send(command); }
public void Handle(RequestApprovmentCommand message) { var requestId = message.HumanResourcesRequestId; var isApproved = message.IsApproved; var managerId = message.ManagerId; var request = TaskApprovmentRequest.Factory.Create(requestId, managerId, isApproved); var response = _approvalTaskRepository.SetApprovalTaskStatus(request); if (!response.Success) { var description = response.Description; var rejected = new SetApprovalStatusRejectedEvent(requestId, description); _bus.RaiseEvent(rejected); return; } var created = new SetApprovalStatusCreatedEvent(requestId); _bus.RaiseEvent(created); }