Пример #1
0
        private async Task CheckProductsAndPricesOf(IEnumerable <RentedProduct> rentedProductList)
        {
            Products = await Tenant.Products
                       .WhereIdIn(rentedProductList.Select(p => p.ProductId))
                       .WhereMarketed(true)
                       .IncludePrices()
                       .ToListAsync();

            ProductPrices = Products.SelectMany(product => product.ProductPrices);

            HasOneOrMoreProductsNotFound    = rentedProductList.Count() != Products.Count();
            HasOneOrMoreProductsNotMarketed = Products.Any(product => !product.Marketed);
            HasOneOrMorePricesNotDefined    = !ProductPrices.Any() ||
                                              ProductPrices.Any(productPrice =>
                                                                productPrice == null ||
                                                                productPrice.UnitRentPrice == null);
        }