public void Handle(PromotionDraftReady @event) { IEnumerable <Editor> editors = _userInRoleRepository.GetAllEditors() .Where(e => e.Id != @event.OwnerId); ApprovalProcess approvalProcess = ApprovalProcess.StartFor(@event.PromotionId, new HashSet <Editor>(editors)); _approvalRepository.Store(approvalProcess); _sheduler.RequestTimeout(new ApprovalProcessTimeout(approvalProcess.Id), TimeSpan.FromDays(3)); }
public void Store(ApprovalProcess approvalProcess) { _context.ApprovalProcesses.Add(approvalProcess); }
public void HandleTimeout(ApprovalProcessTimeout timeoutData) { ApprovalProcess process = _approvalRepository.GetApprovalProcess(timeoutData.ApprovalProcessId); process.Complete(); }