コード例 #1
0
 public void DeleteBookCategory(Guid ID)
 {
     Models.DBObjects.BooksCategory booksCategoryToDelete = booksLibraryDataContext.BooksCategories.FirstOrDefault(x => x.IDBooksCategory == ID);
     if (booksCategoryToDelete != null)
     {
         booksLibraryDataContext.BooksCategories.DeleteOnSubmit(booksCategoryToDelete);
         booksLibraryDataContext.SubmitChanges();
     }
 }
コード例 #2
0
 public void UpdateBookCategory(BooksCategoryModel booksCategoryModel)
 {
     Models.DBObjects.BooksCategory existingBooksCategory = booksLibraryDataContext.BooksCategories.FirstOrDefault(x => x.IDBooksCategory == booksCategoryModel.IDBooksCategory);
     if (existingBooksCategory != null)
     {
         existingBooksCategory.IDBooksCategory  = booksCategoryModel.IDBooksCategory;
         existingBooksCategory.Genre            = booksCategoryModel.Genre;
         existingBooksCategory.ChildAppropriate = booksCategoryModel.ChildAppropriate;
         booksLibraryDataContext.SubmitChanges();
     }
 }
コード例 #3
0
        private Models.DBObjects.BooksCategory MapModelToDbObject(BooksCategoryModel booksCategoryModel)
        {
            Models.DBObjects.BooksCategory dbbookCategoryModel = new Models.DBObjects.BooksCategory();
            if (booksCategoryModel != null)
            {
                dbbookCategoryModel.IDBooksCategory  = booksCategoryModel.IDBooksCategory;
                dbbookCategoryModel.Genre            = booksCategoryModel.Genre;
                dbbookCategoryModel.ChildAppropriate = booksCategoryModel.ChildAppropriate;

                return(dbbookCategoryModel);
            }
            return(null);
        }
コード例 #4
0
        private BooksCategoryModel MapDbObjectToModel(Models.DBObjects.BooksCategory dbbookCategory)
        {
            BooksCategoryModel booksCategoryModel = new BooksCategoryModel();

            if (dbbookCategory != null)
            {
                booksCategoryModel.IDBooksCategory  = dbbookCategory.IDBooksCategory;
                booksCategoryModel.Genre            = dbbookCategory.Genre;
                booksCategoryModel.ChildAppropriate = dbbookCategory.ChildAppropriate;

                return(booksCategoryModel);
            }
            return(null);
        }