コード例 #1
0
 public bool Update(CT_HDNHAP phong)
 {
     try
     {
         using (var db = new QLPhongKaraokeEntities())
         {
             var x = from s in db.CT_HDNHAP
                     where (s.IDHoaDon == phong.IDHoaDon && s.IDHang == phong.IDHang)
                     select s;
             var sv = x.FirstOrDefault();
             if (sv != null)
             {
                 sv.SoLuong    = phong.SoLuong;
                 sv.ThanhTien  = phong.ThanhTien;
                 sv.DonGiaNhap = phong.DonGiaNhap;
                 db.SaveChanges();
             }
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #2
0
 public bool Insert(CT_HDNHAP phong)
 {
     try
     {
         using (var db = new QLPhongKaraokeEntities())
         {
             db.CT_HDNHAP.Add(phong);
             db.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }