示例#1
0
 public bool Insert(PHONG item)
 {
     try
     {
         using (var db = new QLPhongKaraokeEntities())
         {
             db.PHONGs.Add(item);
             db.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
示例#2
0
 public bool Update(PHONG item)
 {
     try
     {
         using (var db = new QLPhongKaraokeEntities())
         {
             var x = from s in db.PHONGs
                     where s.ID == item.ID && s.Deleted == 0
                     select s;
             var sv = x.FirstOrDefault();
             if (sv != null)
             {
                 sv.Ten         = item.Ten;
                 sv.IdLoaiPhong = item.IdLoaiPhong;
                 db.SaveChanges();
             }
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }