P0_TrevorGraham/StoreApplication/StoreMain/Logic/StoreSession.cs
/// <summary>
/// Adds location to db based on a name; returns false if it already exists in db
/// </summary>
/// <param name="storeName"></param>
/// <returns></returns>
Adds location to db based on a name; returns false if it already exists in db
Adds location to db based on a name ; returns false if it already exists in db
public bool AddLocationToDb(string storeName){
            if(db.Locations.SingleOrDefault(x => x.Name ==storeName)!=null){
                return false;
            }
            Location newStore = new Location(){
                Name = storeName
            };
            db.Locations.Add(newStore);
            db.SaveChanges();
            return true;
        }
public bool AddLocationToDb ( string storeName ) { if ( db . Locations . SingleOrDefault ( x => x . Name == storeName ) != null ) { return false ; } Location newStore = new Location ( ) { Name = storeName } ; db . Locations . Add ( newStore ) ; db . SaveChanges ( ) ; return true ; }
Adds location to db based on a name; returns false if it already exists in db
Adds location to db based on a name ; returns false if it already exists in db
//TODO: any checks to perform? //store already exists in db
None
storeName
string
None