Exemple #1
0
 public static bool Add_GiaSP(Gia_SP gia_SP)
 {
     try
     {
         using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities())
         {
             entities.Gia_SP.Add(gia_SP);
             entities.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #2
0
 public static bool Delete_GiaSP(int maGiaSP)
 {
     try
     {
         using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities())
         {
             Gia_SP giaSP = entities.Gia_SP.Where(p => p.ma_GiaSP == maGiaSP).FirstOrDefault();
             entities.Gia_SP.Remove(giaSP);
             entities.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #3
0
 public static bool Update_GiaSP(Gia_SP gia_SP)
 {
     try
     {
         using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities())
         {
             Gia_SP giaSP = entities.Gia_SP.Where(p => p.ma_GiaSP == gia_SP.ma_GiaSP).FirstOrDefault();
             giaSP.ngay_BDSP = gia_SP.ngay_BDSP;
             giaSP.gia_SP1   = gia_SP.gia_SP1;
             entities.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }