TopShelfCustomer/TopShelfCustomer.Api/Controllers/StoreController.cs
/// <summary>
/// GetAllProducts:
///
/// Overload of the Get request method.
/// Fetches all Products from the database and returns them
/// to the caller of this API method.
/// Matches based off of the passed storeName argument.
/// </summary>
/// <returns> a List of Products from that Store </returns>


Overload of the Get request method.
Fetches all Products from the database and returns them
to the caller of this API method.
Matches based off of the passed storeName argument.
Overload of the Get request method . Fetches all Products from the database and returns them to the caller of this API method . Matches based off of the passed storeName argument .
[Route( "api/Store/GetAllProducts" )]
        [HttpGet]
        public IEnumerable<Product> Get () {
            StoreData data = new StoreData();
            var allProducts = data.GetAllProducts();        
            try {               
                if ( allProducts[0] == null ) { return new List<Product>(); }
            } catch ( ArgumentOutOfRangeException e ) {
                Debug.WriteLine( e.Message );
                return new List<Product>();
            } catch ( Exception e ) {
                Debug.WriteLine( e.Message );
                return new List<Product>();
            }
            return allProducts;
        }
[ Route ( " " ) ] [ HttpGet ] public IEnumerable < Product > Get ( ) { StoreData data = new StoreData ( ) ; var allProducts = data . GetAllProducts ( ) ; try { if ( allProducts [ 0 ] == null ) { return new List < Product > ( ) ; } } catch ( ArgumentOutOfRangeException e ) { Debug . WriteLine ( e . Message ) ; return new List < Product > ( ) ; } catch ( Exception e ) { Debug . WriteLine ( e . Message ) ; return new List < Product > ( ) ; } return allProducts ; }
GetAllProducts:
GetAllProducts :
//Store return value of database fetch //Catch exceptions thrown by null Products
a List of Products from that Store
a List of Products from that Store