Пример #1
0
        public StockWithBooksBasket(int stockId, string title, string ean13,
                                    string isbn10, string isbn13, DateTime publishedDate,
                                    IEnumerable <CategoryBasket> categories, IEnumerable <AuthorBasket> authors, PublisherBasket publisher, ImageBasket image,
                                    IEnumerable <IStrategy <SimpleIntRule> > intStrategies, DateTime?returnDate = null)
        {
            StockId    = stockId;
            Title      = title;
            Ean13      = ean13;
            Isbn10     = isbn10;
            Isbn13     = isbn13;
            Categories = categories;
            Authors    = authors;
            Publisher  = publisher;
            Image      = image;

            PublishedDate = publishedDate;
            if (intStrategies is not null)
            {
                foreach (var intStrategy in intStrategies)
                {
                    if (intStrategy is MaxDaysForLendBookStrategy maxDaysForLendBookStrategy)
                    {
                        var maxAllowedReturnDateSet = maxDaysForLendBookStrategy.GetRuleInfo().Result;
                        ReturnDate = returnDate ?? DateTime.UtcNow.AddDays(maxAllowedReturnDateSet.RuleValue);
                    }
                }
            }
        }
Пример #2
0
        public StockWithBooksBasket(int stockId, string title, string ean13,
                                    string isbn10, string isbn13, DateTime publishedDate,
                                    IEnumerable <CategoryBasket> categories, IEnumerable <AuthorBasket> authors, PublisherBasket publisher, ImageBasket image)
        {
            StockId    = stockId;
            Title      = title;
            Ean13      = ean13;
            Isbn10     = isbn10;
            Isbn13     = isbn13;
            Categories = categories;
            Authors    = authors;
            Publisher  = publisher;
            Image      = image;

            PublishedDate = publishedDate;
        }