// Dictionary<ProductCategory, int> PointsDictionary = new Dictionary<ProductCategory, int>();

        public int GetPoints(IProduct product)
        {
            Gaurd.IsNotNull(product, nameof(product));

            // We can add our logic to generat points
            // The Points can be fetched from DB based on the product category
            return(product.Category == ProductCategory.Electronics ? 100 : 50);
        }
Example #2
0
        public RewardController(IRewadsRepository rewadsRepository)
        {
            Gaurd.IsNotNull(rewadsRepository, nameof(rewadsRepository));

            this.rewadsRepository = rewadsRepository;
        }
Example #3
0
        public DbConnection CreateSecondaryConnection()
        {
            Gaurd.AgainstNull(_queriesConnectionString, nameof(_queriesConnectionString));

            return(new SqlConnection(_queriesConnectionString.Value));//);
        }
Example #4
0
        public RewadsRepository(DbContextOptions <RewardsContext> contextOptions)
        {
            Gaurd.IsNotNull(contextOptions, nameof(contextOptions));

            this.contextOptions = contextOptions;
        }
Example #5
0
        public DbConnection CreatePrimaryConnection()
        {
            Gaurd.AgainstNull(_commandsConnectionString, nameof(_commandsConnectionString));

            return(new SqlConnection(_commandsConnectionString.Value));//_commandsConnectionString.Value); Data Source = mello.database.windows.net;initial catalog=MelloApiDatabase;user id=mello;password=
        }