public static Series GetSeries(ComicDataContext db, string name, Author aut, Publisher pub) { var a = from x in db.Series where x.Name == name select x; if (a.Count() == 0) { var series = new Series() { Name = name, Author = aut, Publisher = pub, }; db.Series.InsertOnSubmit(series); db.SubmitChanges(); return series; } return a.First(); }
public static Author GetAuthor(ComicDataContext db, string name) { var a = from x in db.Author where x.Name == name select x; if (a.Count() == 0) { var author = new Author() { Name = name }; db.Author.InsertOnSubmit(author); db.SubmitChanges(); return author; } return a.First(); }