示例#1
0
        Models.Store IStore.FindStoreById(int id)
        {
            Models.Store newfoundstore = new Models.Store();
            Store        query         = _context.Stores.Where(x => x.Id.Equals(id)).First();

            if (query == null)
            {
                newfoundstore = null;
            }

            else
            {
                newfoundstore.Id = query.Id;


                newfoundstore.StoreName = query.StoreName;

                newfoundstore.StoreLocationAddress = query.StoreLocationAddress;

                newfoundstore.StoreLocationCity = query.StoreLocationCity;

                newfoundstore.StoreLocationState   = query.StoreLocationState;
                newfoundstore.StoreLocationCountry = query.StoreLocationCountry;

                newfoundstore.StoreLocationZip = query.StoreLocationCountry;
                newfoundstore.StorePhoneNumber = query.StorePhoneNumber;
            }

            return(newfoundstore);
        }
示例#2
0
        public Models.Store FindStore(string phone_number)
        {
            Models.Store newfoundstore = new Models.Store();


            Store query = _context.Stores.Where(x => x.StorePhoneNumber.Equals(phone_number)).First();

            if (query == null)
            {
                newfoundstore = null;
            }

            else
            {
                newfoundstore.Id = query.Id;


                newfoundstore.StoreLocationAddress = query.StoreLocationAddress;

                newfoundstore.StoreLocationCity = query.StoreLocationCity;

                newfoundstore.StoreLocationState   = query.StoreLocationState;
                newfoundstore.StoreLocationCountry = query.StoreLocationCountry;

                newfoundstore.StoreLocationZip = query.StoreLocationCountry;
                newfoundstore.StorePhoneNumber = query.StorePhoneNumber;
            }

            return(newfoundstore);
        }
示例#3
0
        public List <Models.StoreInventory> ViewStoreInventory(string store_phonenumber)

        {
            Models.Store newfoundstore = new Models.Store();


            Store storequery = _context.Stores.Where(x => x.StorePhoneNumber.Equals(store_phonenumber)).First();

            if (storequery == null)
            {
                newfoundstore = null;
            }

            else
            {
                newfoundstore.Id = storequery.Id;


                newfoundstore.StoreLocationAddress = storequery.StoreLocationAddress;

                newfoundstore.StoreLocationCity = storequery.StoreLocationCity;

                newfoundstore.StoreLocationState   = storequery.StoreLocationState;
                newfoundstore.StoreLocationCountry = storequery.StoreLocationCountry;

                newfoundstore.StoreLocationZip = storequery.StoreLocationCountry;
                newfoundstore.StorePhoneNumber = storequery.StorePhoneNumber;
            }


            List <Models.StoreInventory> storeinventory = new List <Models.StoreInventory>();


            List <StoreInventory> query = _context.StoreInventories.Where(x => x.StoreId.Equals(newfoundstore.Id)).ToList();

            if (query == null)
            {
                storeinventory = null;
            }

            else
            {
                foreach (var item in query)
                {
                    Models.StoreInventory storei = new Models.StoreInventory();
                    storei.Id = item.Id;

                    storei.ProductID = item.ProductId;
                    storei.StoreID   = item.StoreId;

                    storei.ProductQuantity = item.ProductQuantity;
                    storeinventory.Add(storei);
                }
            }

            return(storeinventory);
        }
示例#4
0
        public void AddStore(Models.Store store)
        {
            Store newstore = new Store()
            {
                StoreName            = "ElectoBuy",
                StoreLocationAddress = store.StoreLocationAddress,
                StoreLocationCity    = store.StoreLocationCity,
                StoreLocationState   = store.StoreLocationState,
                StoreLocationCountry = store.StoreLocationCountry,
                StoreLocationZip     = store.StoreLocationZip,
                StorePhoneNumber     = store.StorePhoneNumber,
            };

            _context.Add(newstore);
            _context.SaveChanges();
        }
        private static IStore GenerateProducts(int count)
        {
            IStore store = new Store();
            var generator = RandomGenerator.Instance;

            for (var i = 0; i < count; i++)
            {
                var article = new Article()
                {
                    Price = generator.GetRandomDoubleNumber(i, i + 2),
                    Barcode = generator.GetRandomString(10),
                    Title = generator.GetRandomString(5),
                    Vendor = generator.GetRandomString(6)
                };

                store.AddArticle(article);
            }

            return store;
        }