コード例 #1
0
        static void Main(string[] args)
        {
            using var logStream = new StreamWriter("ef-log.txt");
            var optionsBuilder = new DbContextOptionsBuilder <project0Context>();

            optionsBuilder.UseSqlServer(GetConnectionString());
            optionsBuilder.LogTo(logStream.WriteLine, LogLevel.Information);
            _dbContext = optionsBuilder.Options;


            StoreAppRepository storeAppRepository = new StoreAppRepository(_dbContext);

            CustomerConsole customer = new CustomerConsole(_dbContext);
            AdminConsole    admin    = new AdminConsole(_dbContext);

            Console.WriteLine("Welcome to Discount BestBuy");
            Console.WriteLine("Where we sell the same stuff, at the same prices!!!");
            Console.WriteLine();
            Console.WriteLine("Enter 'A' for Admin or 'C' For Customer:");
            string input = Console.ReadLine().ToLower();

            while (input != "a" && input != "c")
            {
                Console.WriteLine("Enter 'A' for Admin or 'C' For Customer:");
                input = Console.ReadLine().ToLower();
            }
            if (input == "a")
            {
                admin.AdminUI();
            }
            else
            {
                customer.CustomerUI();
            }
        }
コード例 #2
0
 public ProductController(StoreAppRepository storeRepo)
 {
     _storeRepo = storeRepo;
 }
コード例 #3
0
 public InventoryController(StoreAppRepository storeRepo)
 {
     _storeRepo = storeRepo;
 }
コード例 #4
0
 public AdminConsole(DbContextOptions <project0Context> _dbContext)
 {
     storeRepo = new StoreAppRepository(_dbContext);
 }
コード例 #5
0
 public LocationController(StoreAppRepository storeRepo)
 {
     _storeRepo = storeRepo;
 }
コード例 #6
0
        public CustomerController(StoreAppRepository storeRepo, ILogger <CustomerController> logger)
        {
            _storeRepo = storeRepo;

            _logger = logger;
        }
コード例 #7
0
 public OrderController(StoreAppRepository storeRepo)
 {
     _storeRepo = storeRepo;
 }