public async Task <bool> UpdateFundingClaimsCollectionMetaDataAsync(
            FundingClaimsCollectionMetaData fundingClaimsCollectionMetaData,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            var entity = new FundingClaimsCollection()
            {
                CollectionId           = fundingClaimsCollectionMetaData.CollectionId,
                SubmissionOpenDateUtc  = fundingClaimsCollectionMetaData.SubmissionOpenDateUtc,
                SubmissionCloseDateUtc = fundingClaimsCollectionMetaData.SubmissionCloseDateUtc,
                SignatureCloseDateUtc  = fundingClaimsCollectionMetaData.SignatureCloseDateUtc,
                RequiresSignature      = fundingClaimsCollectionMetaData.RequiresSignature == 'Y',
                HelpdeskOpenDateUtc    = fundingClaimsCollectionMetaData.HelpdeskOpenDateUtc,
                DateTimeUpdatedUtc     = fundingClaimsCollectionMetaData.DateTimeUpdatedUtc,
                UpdatedBy      = fundingClaimsCollectionMetaData.UpdatedBy,
                CollectionName = fundingClaimsCollectionMetaData.CollectionName,
                CollectionYear = fundingClaimsCollectionMetaData.CollectionYear,
            };

            var response = await _httpClientService.SendDataAsync($"{_baseUrl}/collection/update", entity, cancellationToken);

            return(true);
        }
        public async Task <IActionResult> UpdateAsync(CancellationToken cancellationToken, [FromBody] FundingClaimsCollection dto)
        {
            var isSuccess = await _collectionReferenceDataService.UpdateCollection(cancellationToken, dto);

            if (isSuccess)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }
コード例 #3
0
        public async Task <bool> UpdateCollection(CancellationToken cancellationToken, FundingClaimsCollection dto)
        {
            using (var context = _fundingClaimsDataContext())
            {
                var entity = await context.CollectionDetail.SingleOrDefaultAsync(x => x.CollectionId == dto.CollectionId, cancellationToken);

                if (entity == null)
                {
                    _logger.LogError($"Unable to find funding claims Collection metadata with id: {dto.CollectionName}");
                    return(false);
                }

                entity.SubmissionOpenDateUtc  = dto.SubmissionOpenDateUtc;
                entity.SubmissionCloseDateUtc = dto.SubmissionCloseDateUtc;
                entity.SignatureCloseDateUtc  = dto.SignatureCloseDateUtc;
                entity.RequiresSignature      = dto.RequiresSignature;
                entity.HelpdeskOpenDateUtc    = dto.HelpdeskOpenDateUtc;
                entity.DateTimeUpdatedUtc     = dto.DateTimeUpdatedUtc;
                entity.UpdatedBy = dto.UpdatedBy;

                await context.SaveChangesAsync(cancellationToken);

                return(true);
            }
        }