예제 #1
0
파일: DBHelper.cs 프로젝트: apoorv020/klib
 // BEGIN Static Builders
 private static Klib.Book Build(Book book)
 {
     var builtBook = new Klib.Book();
     builtBook.UID = book.UID;
     builtBook.Title = book.Title;
     builtBook.Author = book.Author;
     builtBook.ISBN10 = book.ISBN10;
     builtBook.ISBN13 = book.ISBN13;
     builtBook.UniqueMap = book.UniqueMap;
     builtBook.Owner = book.Owner;
     return builtBook;
 }
예제 #2
0
파일: DBHelper.cs 프로젝트: apoorv020/klib
 private static void Write(Book book)
 {
     // For writing new book and updating exisitng book
     var newBook = new Klib.Book();
     var existingBookCount = db.Books
         .Select(thisBook => thisBook.UID == book.UID)
         .Count();
     if (existingBookCount == 0)
     {
         int resourceUID = WriteResource();
         newBook.UID = resourceUID;
     }
     else
         newBook = Build(book);
     db.Books.InsertOnSubmit(newBook);
     db.SubmitChanges();
 }