Exemplo n.º 1
0
 public static bool Add_HangSX(Loai_SP loaiSP)
 {
     try
     {
         using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities())
         {
             entities.Loai_SP.Add(loaiSP);
             entities.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 2
0
 public static bool Delete_LoaiSP(int maLoai)
 {
     try
     {
         using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities())
         {
             Loai_SP loai_SP = entities.Loai_SP.Where(p => p.ma_Loai == maLoai).FirstOrDefault();
             entities.Loai_SP.Remove(loai_SP);
             entities.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 3
0
 public static bool Update_LoaiSP(Loai_SP loaiSP)
 {
     try
     {
         using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities())
         {
             Loai_SP loai_SP = entities.Loai_SP.Where(p => p.ma_Loai == loaiSP.ma_Loai).FirstOrDefault();
             loai_SP.ten_Loai = loaiSP.ten_Loai;
             entities.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }