Exemple #1
0
        public async Task <DelegationHistory> GetHistory(DelegationHistoryQuery query)
        {
            var history = await _db.DelegationsHistories
                          .Include(d => d.Delegation)
                          .FirstOrDefaultAsync(dh => dh.Id == query.Id &&
                                               (query.PartyId == Constants.SchemeOwnerPartyId || dh.Delegation.PolicyIssuer == query.PartyId))
            ;

            return(history);
        }
Exemple #2
0
        public async Task <DelegationHistory> GetDelegationHistoryById(DelegationHistoryQuery query)
        {
            var history = await _db.DelegationsHistories
                          .Include(d => d.Delegation)
                          .FirstOrDefaultAsync(dh => dh.Id == query.Id &&
                                               (query.PartyId == null || dh.Delegation.PolicyIssuer == query.PartyId))
                          .ConfigureAwait(false);

            return(history);
        }
        public async Task <IActionResult> GetDelegationHistoryJson(DelegationHistoryQuery query)
        {
            query.PartyId = User.GetPartyId();

            var delegationHistory = await _delegationService.GetDelegationHistoryById(query);

            if (delegationHistory == null)
            {
                return(NotFound());
            }

            var fileName = $"History-{delegationHistory.CreatedDate:yy-MM-dd}-{delegationHistory.Delegation?.AuthorizationRegistryId}.json";

            return(BuildJsonDownloadFileResult(fileName, delegationHistory.Policy));
        }
 public async Task <DelegationHistory> GetDelegationHistoryById(DelegationHistoryQuery query)
 {
     return(await _delegationsRepository.GetHistory(query));
 }