Exemple #1
0
 public bool XoaHH(int maHH)
 {
     try
     {
         HANG_HOA hhDB = db.HANG_HOA.SingleOrDefault(p => p.MAHH == maHH && p.TRANGTHAIXOA == false);
         hhDB.TRANGTHAIXOA = true;
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Exemple #2
0
 public bool SuaHH(HangHoaDTO hh)
 {
     try
     {
         HANG_HOA hhDB = db.HANG_HOA.SingleOrDefault(p => p.MAHH == hh.Mahh && p.TRANGTHAIXOA == false);
         hhDB.TENHH = hh.Tenhh;
         hhDB.DVT   = hh.Dvt;
         hhDB.SLTON = hh.Slton;
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Exemple #3
0
 public bool ThemHH(HangHoaDTO hh)
 {
     try
     {
         HANG_HOA hhDB = new HANG_HOA
         {
             TENHH = hh.Tenhh,
             DVT   = hh.Dvt,
             SLTON = hh.Slton
         };
         db.HANG_HOA.Add(hhDB);
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }