private IEnumerable <string> insertTags(IEnumerable <string> tags) { IEnumerable <string> newtags = null; using (FileDataModelContainer db = new FileDataModelContainer()) { var query = from c in db.TagTable //where !tags.Contains(c.tag) select c.tag; newtags = tags.Except(query).ToList(); foreach (string t in newtags) { TagTable tabtable = new TagTable(); tabtable.tag = t; db.AddToTagTable(tabtable); } db.SaveChanges(); } return(newtags); }
private IEnumerable<string> insertTags(IEnumerable<string> tags) { IEnumerable<string> newtags = null; using (FileDataModelContainer db = new FileDataModelContainer()) { var query = from c in db.TagTable //where !tags.Contains(c.tag) select c.tag; newtags = tags.Except(query).ToList(); foreach(string t in newtags){ TagTable tabtable = new TagTable(); tabtable.tag = t; db.AddToTagTable(tabtable); } db.SaveChanges(); } return newtags; }