Exemplo n.º 1
0
 public int DoiMatKhau(int id, string matkhau)
 {
     using (CSDLContext db = new CSDLContext())
     {
         AdminAccount admin = db.AdminAccount.Find(id);
         admin.Password        = matkhau;
         db.Entry(admin).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
     return(1);
 }
Exemplo n.º 2
0
 public int xoa(int id)
 {
     try
     {
         using (CSDLContext db = new CSDLContext())
         {
             Laptop laptop = db.Laptop.Find(id);
             db.Entry(laptop).State = EntityState.Deleted;
             db.SaveChanges();
         }
         return(1);
     }
     catch (Exception e)
     { return(0); }
 }
Exemplo n.º 3
0
 public int sua(int id, string tensp, int giatien, string thongso, int MaTH)
 {
     try
     {
         using (CSDLContext db = new CSDLContext())
         {
             Laptop laptop = db.Laptop.Find(id);
             laptop.TenLaptop       = tensp;
             laptop.Giatien         = giatien;
             laptop.ThongSo         = thongso;
             laptop.MaTH            = MaTH;
             db.Entry(laptop).State = EntityState.Modified;
             db.SaveChanges();
         }
         return(1);
     }
     catch (Exception e)
     { return(0); }
 }