Ejemplo n.º 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
            }));
        }