Exemple #1
0
        public async Task <ListQueryResult <CreditRequestDto> > GetApprovedClientRequestDtosAsync(ApprovedClientRequestsQuery query)
        {
            var rightsRes = await CheckEmployeeRightsAsync(query.EmployeeId, EmployeeRights.Operator);

            if (rightsRes.IsFailed)
            {
                return(new ListQueryResult <CreditRequestDto>(query, null, false).From(rightsRes));
            }
            var clientRes = await GetClientAsync(query.ClientId, query.PassportNumber);

            if (clientRes.IsFailed)
            {
                return(new ListQueryResult <CreditRequestDto>(query, null, false).From(clientRes));
            }
            return(await _creditRequestService.GetApprovedClientRequestsDtosAsync(
                       new TOFI.TransferObjects.Credits.CreditRequest.Queries.ApprovedClientRequestsQuery
            {
                ClientId = clientRes.Value.Id
            }));
        }