コード例 #1
0
 public List <ShotLizaBook> GetAll()
 {
     using (var db = new ShotLizaDataContext())
     {
         return(db.Books.Include(x => x.Authors).ToList());
     }
 }
コード例 #2
0
 public void AddBook(ShotLizaBook book)
 {
     using (var db = new ShotLizaDataContext())
     {
         db.Books.Add(book);
         db.SaveChanges();
     }
 }
コード例 #3
0
        public void RemoveBook(ShotLizaBook book)
        {
            using (var db = new ShotLizaDataContext())
            {
                db.Entry(book).State = EntityState.Deleted;

                db.SaveChanges();
            }
        }