Example #1
0
        public IEnumerable <CStore> GetAllStores()
        {
            using var context = new Project0databaseContext(_contextOptions);
            var dbStores = context.Stores.ToList();

            if (dbStores == null)
            {
                return(null);
            }
            var domainStores = DomainModelMapper.MapStore(dbStores);

            return(domainStores);
        }
Example #2
0
        public IEnumerable <CStore> GetAllStoresByZipcode(string zipCode)
        {
            using var context = new Project0databaseContext(_contextOptions);
            IEnumerable <Store> dbStores;

            try
            {
                dbStores = context.Stores.Where(x => x.Zipcode == zipCode).ToList();
            }
            catch (Exception e)
            {
                return(null);
            }
            var stores = DomainModelMapper.MapStore(dbStores);

            return(stores);
        }