Пример #1
0
 public bool ThemNhaO(string TenLoaiNha)
 {
     try{
         tblLoaiNhaO_CongTrinh loainhamoi = new tblLoaiNhaO_CongTrinh();
         loainhamoi.Ten = TenLoaiNha;
         db.tblLoaiNhaO_CongTrinh.Add(loainhamoi);
         db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Пример #2
0
 public bool SuaTenNha(int ID, string TenMoi)
 {
     try
     {
         tblLoaiNhaO_CongTrinh nhacansua = (from n in db.tblLoaiNhaO_CongTrinh
                                            select n).Single(n => n.LoaiNhaO == ID);
         nhacansua.Ten = TenMoi;
         db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Пример #3
0
        public bool XoaNhaO(int ID)
        {
            try
            {
                tblLoaiNhaO_CongTrinh nhacanxoa = (from n in db.tblLoaiNhaO_CongTrinh
                                                   select n).Single(n => n.LoaiNhaO == ID);
                db.tblLoaiNhaO_CongTrinh.Remove(nhacanxoa);
                db.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }