Example #1
0
 public static void deleteTitle(string isbn)
 {
     BooksDataContext dc = new BooksDataContext();
     var matchedTitle = (from t in dc.GetTable<Title>()
                          where t.ISBN == isbn
                          select t).SingleOrDefault();
     dc.Titles.DeleteOnSubmit(matchedTitle);
     dc.SubmitChanges();
 }
Example #2
0
 public static void DeleteAuthor(int authorID)
 {
     BooksDataContext dc = new BooksDataContext();
        var matchedAuthor = (from a in dc.GetTable<Author>()
                      where a.AuthorID == authorID
                      select a).SingleOrDefault();
     dc.Authors.DeleteOnSubmit(matchedAuthor);
     dc.SubmitChanges();
 }
Example #3
0
        public static void DeleteAuthorISBN(string isbn, int id)
        {
            BooksDataContext dc = new BooksDataContext();

            var matchedAuthorISBN = (from authorisbn in dc.GetTable<AuthorISBN>()
                                     where authorisbn.ISBN == isbn && authorisbn.AuthorID == id
                                     select authorisbn).SingleOrDefault();

            dc.AuthorISBNs.DeleteOnSubmit(matchedAuthorISBN);
            dc.SubmitChanges();
        }
Example #4
0
        public static void insertOrUpdateTitle(string isbn, string title, int edition, string copyright)
        {
            BooksDataContext dc = new BooksDataContext();

            Table<Title> titles = Accessor.getTitlesTable();
            Title t = new Title();

            t.ISBN = isbn;
            t.BookTitle = title;
            t.EditionNumber = edition;
            t.Copyright = copyright;

            titles.InsertOnSubmit(t);
            titles.Context.SubmitChanges();
            dc.SubmitChanges();
        }
Example #5
0
        public static void InsertOrUpdateAuthorISBN(string isbn, int id)
        {
            BooksDataContext dc = new BooksDataContext();

            Table<AuthorISBN> authorISBNs = dc.GetTable<AuthorISBN>();

            AuthorISBN a = new AuthorISBN();

            a.AuthorID = id;
            a.ISBN = isbn;

            authorISBNs.InsertOnSubmit(a);
            authorISBNs.Context.SubmitChanges();
            dc.SubmitChanges();
        }
Example #6
0
 public static void InsertOrUpdateAuthor(string first, string last)
 {
     BooksDataContext dc = new BooksDataContext();
     Table<Author> authors = Accessor.GetAuthorsTable();
     Author au = new Author();
     au.FirstName = first;
     au.LastName = last;
     authors.InsertOnSubmit(au);
     authors.Context.SubmitChanges();
     dc.SubmitChanges();
 }