My linq query won't insert my data. What am I doing wrong?
class Query
{
musicEntities db = new musicEntities();
public bool findArtist(string artist)
{
bool status = db.Artists.Any(w => w.Name.Contains(artist));
return status;
}
public void insertArtist(string artist)
{
if (findArtist(artist) == false)
{
Artist art = new Artist
{
Name = artist
};
db.Artists.AddObject(art);
db.SaveChanges();
}
}
}