コード例 #1
0
        public static ChiTietSanPham FindCTSach(int id)
        {
            ChiTietSanPham b = null;

            using (var db = new Context())
            {
                b = db.ChiTietSanPham.Find(id);
                db.Dispose();
            }
            return(b);
        }
コード例 #2
0
        public static ChiTietSanPham UpdateCTSach(int masach, string tenchitiet, string chitiet)
        {
            ChiTietSanPham b = null;

            using (var db = new Context())
            {
                b                 = db.ChiTietSanPham.Find(masach);
                b.tenchitiet      = tenchitiet;
                b.chitiet         = chitiet;
                db.Entry(b).State = EntityState.Modified;
                db.SaveChanges();
                db.Dispose();
            }
            return(b);
        }