コード例 #1
0
        public async Task <PagedResult <DepositApproval> > BrowseAsync(GetConsumerDepositApprovals query)
        {
            if (query is null)
            {
                return(PagedResult <DepositApproval> .Empty);
            }

            var depositApprovals = DepositApprovals.AsQueryable();

            if (!(query.DataAssetId is null))
            {
                depositApprovals = depositApprovals.Where(a => a.AssetId == query.DataAssetId);
            }

            if (!(query.Provider is null))
            {
                depositApprovals = depositApprovals.Where(a => a.Provider == query.Provider);
            }

            if (query.OnlyPending)
            {
                depositApprovals = depositApprovals.Where(a => a.State == DepositApprovalState.Pending);
            }

            return(await depositApprovals.OrderByDescending(a => a.Timestamp).PaginateAsync(query));
        }
コード例 #2
0
 public Task UpdateAsync(DepositApproval depositApproval)
 => DepositApprovals.ReplaceOneAsync(a => a.Id == depositApproval.Id, depositApproval);
コード例 #3
0
 public Task AddAsync(DepositApproval depositApproval)
 => DepositApprovals.InsertOneAsync(depositApproval);
コード例 #4
0
 public Task <DepositApproval> GetAsync(Keccak id)
 => DepositApprovals.Find(a => a.Id == id).FirstOrDefaultAsync();