Пример #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();
            }
        }