public static void addNewBook(BOOK book) { using (var dtbEntity = new QLTVEntities1()) { dtbEntity.BOOKS.Add(book); dtbEntity.SaveChanges(); } }
public static void addNewCard(CARD card) { using (var dtbEntity = new QLTVEntities1()) { dtbEntity.CARDS.Add(card); dtbEntity.SaveChanges(); } }
public static void addNewReader(READER reader) { using (var dtbEntity = new QLTVEntities1()) { dtbEntity.READERS.Add(reader); dtbEntity.SaveChanges(); } }
public static void addNewCard(CARD card) { using (var dtbEntity = new QLTVEntities1()) { dtbEntity.CARDS.Add(card); dtbEntity.SaveChanges(); MessageBox.Show("Add successfully!"); } }
public static void addNewBook(BOOK book) { using (var dtbEntity = new QLTVEntities1()) { dtbEntity.BOOKS.Add(book); dtbEntity.SaveChanges(); MessageBox.Show("Add successfully!"); } }
public static void addNewReader(READER reader) { using (var dtbEntity = new QLTVEntities1()) { dtbEntity.READERS.Add(reader); dtbEntity.SaveChanges(); MessageBox.Show("Add successfully!"); } }
public static List <CLASS> getListReader() { List <CLASS> list = new List <CLASS>(); using (var dtbEntity = new QLTVEntities1()) { list = dtbEntity.CLASSES.ToList(); } return(list); }
public static void deleteReader(BOOK book) { using (var dtbEntity = new QLTVEntities1()) { var tempObject = dtbEntity.BOOKS.SingleOrDefault(n => n.idBook == book.idBook); if (tempObject != null) { dtbEntity.BOOKS.Remove(tempObject); dtbEntity.SaveChanges(); } } }
public static void deleteReader(READER reader) { using (var dtbEntity = new QLTVEntities1()) { var tempObject = dtbEntity.READERS.SingleOrDefault(n => n.idReader == reader.idReader); if (tempObject != null) { dtbEntity.READERS.Remove(tempObject); dtbEntity.SaveChanges(); } } }
public static void updateReader(READER reader) { using (var dtbEntity = new QLTVEntities1()) { var tempObject = dtbEntity.READERS.SingleOrDefault(n => n.idReader == reader.idReader); if (tempObject != null) { tempObject.nameReader = reader.nameReader; tempObject.idClass = reader.idClass; tempObject.sex = reader.sex; tempObject.address = reader.address; tempObject.birthday = reader.birthday; dtbEntity.SaveChanges(); } } }
public static void updateBook(BOOK book) { using (var dtbEntity = new QLTVEntities1()) { var tempObject = dtbEntity.BOOKS.SingleOrDefault(n => n.idBook == book.idBook); if (tempObject != null) { tempObject.nameBook = book.nameBook; tempObject.idAuthor = book.idAuthor; tempObject.idPublisher = book.idPublisher; tempObject.idTypeOfBook = book.idTypeOfBook; tempObject.numberBook = book.numberBook; tempObject.yearRealeas = book.yearRealeas; dtbEntity.SaveChanges(); } } }