Esempio n. 1
0
        /// <summary>
        ///     Function try get data from db,
        ///     if request isn't the first, return data from cache
        ///     else do new request to db and return them
        /// </summary>
        /// <returns>Products list</returns>
        public List <ProductDto> GetProducts()
        {
            _products = _databaseBase.GetDatabaseList <ProductDto>().Result;

            if (_products.IsNullOrEmpty() || _products.Any(i => i.Article == 0))
            {
                throw new NullReferenceException();
            }

            return(_products);
        }