示例#1
0
        public ListQueryResult <CreditRequestViewModel> GetApprovedClientRequests(ApprovedClientRequestsQuery query)
        {
            var rightsRes = CheckEmployeeRights(query.EmployeeId, EmployeeRights.Operator);

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

            if (clientRes.IsFailed)
            {
                return(new ListQueryResult <CreditRequestViewModel>(query, null, false).From(clientRes));
            }
            return(_creditRequestService.GetApprovedClientRequests(
                       new TOFI.TransferObjects.Credits.CreditRequest.Queries.ApprovedClientRequestsQuery
            {
                ClientId = clientRes.Value.Id
            }));
        }
示例#2
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
            }));
        }