P0_TrevorGraham/StoreApplication/StoreMain/Logic/StoreSession.cs
/// <summary>
/// Returns the price as a double for the product in the current store location
/// </summary>
/// <param name="prductName"></param>
/// <returns></returns>
Returns the price as a double for the product in the current store location
Returns the price as a double for the product in the current store location
public double GetProductPrice(string productName){
            if(StoreIsChosen()){
                var inv = db.Inventories.Include(x=>x.Product).Where(x=>x.Location==currentLocation);
                var tinv = inv.FirstOrDefault(x=>x.Product.ProductName==productName);
                if(tinv!=null)
                return tinv.Product.Price;
            }
            return 0.0;
        }
public double GetProductPrice ( string productName ) { if ( StoreIsChosen ( ) ) { var inv = db . Inventories . Include ( x => x . Product ) . Where ( x => x . Location == currentLocation ) ; var tinv = inv . FirstOrDefault ( x => x . Product . ProductName == productName ) ; if ( tinv != null ) return tinv . Product . Price ; } return 0.0 ; }
Returns the price as a double for the product in the current store location
Returns the price as a double for the product in the current store location
// return currentLocation.Inventories.SingleOrDefault(x => x.Product.ProductName == productName).Product.Price;
None
productName
string
prductName
None