public Store GetStoreByID(int id)
        {
            using var _context = new Project0Context(_options);
            StoreDAL query = _context.Stores
                             .Include(s => s.StoreItems)
                             .ThenInclude(p => p.Product)
                             .First(s => s.Id == id);

            if (query != null)
            {
                var inventory = query.StoreItems.Select(
                    x => new KeyValuePair <Product, int>(
                        new Product(x.Product.Id, x.Product.Name, x.Product.Price), x.Quantity)).ToList();

                return(new Store
                {
                    ID = query.Id,
                    Name = query.Name,
                    City = query.City,
                    State = query.State,
                    GrossProfit = query.Profit,
                    Inventory = inventory.ToDictionary(x => x.Key, y => y.Value)
                });
            }
            else
            {
                throw new Exception("Could not locate store with this ID");
            }
        }
        public void AddStore(Store store)
        {
            using var _context = new Project0Context(_options);
            var newStore = new StoreDAL
            {
                Name   = store.Name,
                City   = store.City,
                State  = store.State,
                Profit = store.GrossProfit,
            };

            _context.Add(newStore);
            _context.SaveChanges();
        }
        public void AddToInventory(Product product, Store store, int quantity)
        {
            using var _context = new Project0Context(_options);
            //Check store and product exist
            StoreDAL   s = _context.Stores.Find(store.ID);
            ProductDAL p = _context.Products.Find(product.ID);

            if (s == null || p == null)
            {
                throw new Exception("Product or store does not exist in database");
            }
            StoreItemDAL newInventoryItem = new StoreItemDAL
            {
                //Id is auto incrementing, so no need to instantiate one here
                StoreId   = store.ID,
                ProductId = product.ID,
                Quantity  = quantity
            };

            _context.Add(newInventoryItem);
            _context.SaveChanges();
        }