Beispiel #1
0
		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();
		}
Beispiel #2
0
		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();
		}