Exemple #1
0
        private static void SeedRules(LendDbContext dbContext)
        {
            var simpleIntRulesToSeed = new List <SimpleIntRule>()
            {
                new SimpleIntRule("MaxLendDays", "Maximum allowed number of days to lend book", 30,
                                  typeof(MaxDaysForLendBookStrategy)),
                new SimpleIntRule("MaxPossibleBooksToLend", "Maximum books to be borrowed by user in particular point of time", 3, typeof(MaxPossibleBooksToLendStrategy))
            };

            var simpleBooleanRulesToSeed = new List <SimpleBooleanRule>()
            {
                new SimpleBooleanRule("CheckDebtor", "If set to true then debtor cannot borrow book", true, typeof(CheckCustomerDebtorStrategy)),
                new SimpleBooleanRule("CheckBorrowedBooks", "If set to true checks if customer already borrowed requested books", true, typeof(CheckCustomerBorrowedRequestingBooksStrategy)),
                new SimpleBooleanRule("CheckBorrowedStocks", "If set to true checks if customer already borrowed requested stocks", true, typeof(CheckCustomerBorrowedRequestingStocksStrategy))
            };

            dbContext.SimpleIntRules.AddRange(simpleIntRulesToSeed);
            dbContext.SimpleBooleanRules.AddRange(simpleBooleanRulesToSeed);
            if (dbContext.SaveChanges() < 1)
            {
                throw new Exception("Error with seeding customers");
            }
        }
 public LendedBasketRepository(LendDbContext lendDbContext)
 {
     _lendDbContext = lendDbContext;
 }
Exemple #3
0
 public SimpleIntRuleRepository(LendDbContext lendDbContext)
 {
     _lendDbContext = lendDbContext;
 }
Exemple #4
0
 public SimpleBooleanRuleRepository(LendDbContext lendDbContext)
 {
     _lendDbContext = lendDbContext;
 }