예제 #1
0
        public static List <ApprovalViewModel> GetApprovals(ApprovalState approvalState)
        {
            var approvals          = ApprovalRepository.FindApprovalsByApprovalState(approvalState);
            var approvalViewModels = ApprovalViewModelAssembler.Assemble(approvals);

            return(approvalViewModels);
        }
예제 #2
0
        public void Approve()
        {
            if (ApprovalRepository.FindApprovalsByApprovalState(ApprovalState.Approved).Count != 0)
            {
                throw new ApprovalException("Another Approval has already been Approved");
            }

            if (ApprovalState == ApprovalState.Pending)
            {
                ApprovalState = ApprovalState.Approved;
                EmailServerServiceFactory.EmailServer.SendEmail(CustomerEmail, FormatApprovedEmail());
            }
            else
            {
                throw new ApprovalException("Approval not in Pending state");
            }
        }