예제 #1
0
        public static void Delect(WindowsAuthenticationWebApplication.Book book)
        {
            LibraryManagementBDEntities lms = new LibraryManagementBDEntities();


            var deleteupd = lms.Books.Where(b => b.BookID == book.BookID).FirstOrDefault();

            lms.Books.Remove(deleteupd);
            lms.SaveChanges();
        }
예제 #2
0
        public static void Insert(WindowsAuthenticationWebApplication.Book book)
        {
            LibraryManagementBDEntities lms = new LibraryManagementBDEntities();

            string fileNameToInsert = HttpContext.Current.Session["ImagePath"].ToString();

            if (fileNameToInsert != string.Empty)
            {
                book.ImageFile = fileNameToInsert;
                lms.Books.Add(book);
                lms.SaveChanges();
            }
        }
예제 #3
0
        public static void Update(WindowsAuthenticationWebApplication.Book book)
        {
            LibraryManagementBDEntities lms = new LibraryManagementBDEntities();

            string fileNameToUpdate = HttpContext.Current.Session["ImagePath"].ToString();

            if (fileNameToUpdate != string.Empty)
            {
                var upd = lms.Books.Where(b => b.BookID == book.BookID).FirstOrDefault();

                upd.BookTitle  = book.BookTitle;
                upd.AuthorName = book.AuthorName;
                upd.FacultyID  = book.FacultyID;
                book.ImageFile = fileNameToUpdate;
                lms.Books.Add(book);
                lms.SaveChanges();
            }
        }
예제 #4
0
        public static List <WindowsAuthenticationWebApplication.Book> Select()
        {
            LibraryManagementBDEntities lms = new LibraryManagementBDEntities();

            return(lms.Books.ToList());
        }