protected virtual async Task <bool> IsAssetInfoValidAsync(CreateOrderLineDto orderLine,
                                                                  OrderCreationResource resource)
        {
            var mapping = (await _grantedStoreAppService.GetListAsync(new GetGrantedStoreListDto
            {
                MaxResultCount = 1,
                StoreId = resource.Input.StoreId,
                AssetId = orderLine.GetBookingAssetId()
            })).Items.FirstOrDefault();

            if (mapping is null)
            {
                mapping = (await _grantedStoreAppService.GetListAsync(new GetGrantedStoreListDto
                {
                    MaxResultCount = 1,
                    AllowAll = true
                })).Items.FirstOrDefault();
            }

            if (mapping is null)
            {
                return(false);
            }

            var productAsset = (await _productAssetAppService.GetListAsync(
                                    new GetProductAssetListDto
            {
                MaxResultCount = 1,
                StoreId = resource.Input.StoreId,
                ProductId = orderLine.ProductId,
                ProductSkuId = orderLine.ProductSkuId,
                AssetId = orderLine.GetBookingAssetId(),
                PeriodSchemeId = orderLine.GetBookingPeriodSchemeId()
            }
                                    )).Items.FirstOrDefault();

            return(productAsset is not null);
        }
Ejemplo n.º 2
0
 public virtual Task <PagedResultDto <GrantedStoreDto> > GetListAsync(GetGrantedStoreListDto input)
 {
     return(_service.GetListAsync(input));
 }