private CreditAccountDto FillAccount(CreditRequestDto request) { return(new CreditAccountDto { AgreementDate = DateTime.Now, CreditAgreementNumber = Guid.NewGuid().ToString(), CreditType = request.CreditType, TotalMonthDuration = request.MonthDuration, Client = request.Client, Currency = request.CreditSum.Currency, Description = request.CreditPurpose, CreditRequest = request }); }
private CommandResult UpdateCreditRequest(ApproveCommand command, CreditRequestDto request) { var updateRes = _creditRequestService.UpdateModel(request); if (updateRes.IsFailed) { return(new CommandResult(command, false).From(updateRes)); } var signRes = SignApprove(command, request); if (signRes.IsFailed) { //Well this is not good } return(new CommandResult(command, true)); }
private async Task <CommandResult> SignApproveAsync(ApproveCommand command, CreditRequestDto request) { var employeeRes = await GetEmployeeAsync(command.EmployeeId); if (employeeRes.IsFailed) { return(new CommandResult(command, false).From(employeeRes)); } if (employeeRes.Value == null || request == null) { return(new CommandResult(command, false).Error("Invalid command")); } var action = new RequestActionDto { Timestamp = DateTime.Now, Employee = employeeRes.Value, CreditRequest = request, ActionType = GetActionType(command.GetType().Name) }; action.Signature = GetApproveSignature(action, command); return(await _requestActionService.CreateModelAsync(action)); }
private CreditAccountStateDto FillAccountState(CreditRequestDto request, CreditAccountDto account) { return(new CreditAccountStateDto { CreditAccount = account, Month = 0, InterestCounted = new PriceDto { Value = 0, Currency = account.Currency }, FinesForOverdue = new PriceDto { Value = 0, Currency = account.Currency }, TotalInterestSumNotPaid = new PriceDto { Value = 0, Currency = account.Currency }, RemainDebt = new PriceDto { Value = request.CreditSum.Value, Currency = request.CreditSum.Currency }, MainDebtRemain = new PriceDto { Value = 0, Currency = account.Currency } }); }
private async Task <CommandResult> UpdateCreditRequestAsync(ApproveCommand command, CreditRequestDto request) { var updateRes = await _creditRequestService.UpdateModelAsync(request); if (updateRes.IsFailed) { return(new CommandResult(command, false).From(updateRes)); } var signRes = await SignApproveAsync(command, request); if (signRes.IsFailed) { //Well this is not good } return(new CommandResult(command, true)); }