TopShelfCustomer/TopShelfCustomer.Api/Controllers/StoreController.cs
/// <summary>
/// GetStoreById:
///
/// Overload for the Get request method.
/// Returns a Store that matches the id argument.
/// </summary>
/// <param name="id"> The id to match to a Store </param>
/// <returns> A Store with a matching Id property value </returns>


Overload for the Get request method.
Returns a Store that matches the id argument.
Overload for the Get request method . Returns a Store that matches the id argument .
[Route( "api/Store/GetStoreById/{id:int}" )]
        [HttpGet]
        public Store Get ( int id ) {
            StoreData data = new StoreData();
            var store = data.GetStoreById( id );        
            try {               
                if ( store[0] == null ) { return new Store(); }
            } catch ( ArgumentOutOfRangeException e ) {
                Debug.WriteLine( e.Message );
                return new Store();
            } catch ( Exception e ) {
                Debug.WriteLine( e.Message );
                return new Store();
            }
            return store[0];        
        }
[ Route ( " " ) ] [ HttpGet ] public Store Get ( int id ) { StoreData data = new StoreData ( ) ; var store = data . GetStoreById ( id ) ; try { if ( store [ 0 ] == null ) { return new Store ( ) ; } } catch ( ArgumentOutOfRangeException e ) { Debug . WriteLine ( e . Message ) ; return new Store ( ) ; } catch ( Exception e ) { Debug . WriteLine ( e . Message ) ; return new Store ( ) ; } return store [ 0 ] ; }
GetStoreById:
GetStoreById :
//Store return value of database fetch //Catch exceptions thrown by null Products //Return first matching entry
A Store with a matching Id property value
A Store with a matching Id property value
id
int
The id to match to a Store
The id to match to a Store