Esempio n. 1
0
 public bool Update(LOAIPHONG item)
 {
     try
     {
         using (var db = new QLPhongKaraokeEntities())
         {
             var x = from s in db.LOAIPHONGs
                     where s.ID == item.ID && s.Deleted == 0
                     select s;
             var sv = x.FirstOrDefault();
             if (sv != null)
             {
                 sv.Ten     = item.Ten;
                 sv.GiaDem  = item.GiaDem;
                 sv.GiaNgay = item.GiaNgay;
                 sv.SoLuong = item.SoLuong;
                 db.SaveChanges();
             }
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 2
0
 public bool Insert(LOAIPHONG item)
 {
     try
     {
         using (var db = new QLPhongKaraokeEntities())
         {
             db.LOAIPHONGs.Add(item);
             db.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }