P1_TrevorGraham/MvcStoreApplication/Repository/Repository.cs
/// <summary>
/// checks if a location is in the db based on id and name, and adds it if it doesn't already exist
/// </summary>
/// <param name="location"></param>
/// <returns></returns>
checks if a location is in the db based on id and name, and adds it if it doesn't already exist
checks if a location is in the db based on id and name and adds it if it doesn ' t already exist
public bool AttemptAddLocationToDb(Location location)
        {
            if (!LocationIsInDb(location))
            {
                _dbContext.Locations.Add(location);
                _dbContext.SaveChanges();
                return LocationIsInDb(location);
            }
            return false;
        }
public bool AttemptAddLocationToDb ( Location location ) { if ( ! LocationIsInDb ( location ) ) { _dbContext . Locations . Add ( location ) ; _dbContext . SaveChanges ( ) ; return LocationIsInDb ( location ) ; } return false ; }
checks if a location is in the db based on id and name, and adds it if it doesn't already exist
checks if a location is in the db based on id and name and adds it if it doesn ' t already exist
//if there is not a location in the db with the same id or name
None
location
Location
None