Пример #1
0
 public bool Insert(CTDATHANG chitiet)
 {
     try
     {
         db.CTDATHANGs.Add(chitiet);
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
 public bool InsertDGMonAn(DANHGIAMONAN entity)
 {
     try
     {
         db.DANHGIAMONANs.Add(entity);
         db.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Пример #3
0
        //đổi mật khẩu
        public int ChangePassword(int id, string matkhaucu_txt, string matkhaumoi_txt, string matkhaumoi2_txt)
        {
            var result = db.KHACHHANGs.SingleOrDefault(x => x.MaKH == id);

            if (result.MatKhau == matkhaucu_txt && matkhaumoi_txt != result.MatKhau)
            {
                if (matkhaumoi2_txt == matkhaumoi_txt)
                {
                    result.MatKhau = matkhaumoi_txt;
                    db.SaveChanges();
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                return(-1);
            }
        }
Пример #4
0
 public int Insert(DONDATHANG dondathang)
 {
     db.DONDATHANGs.Add(dondathang);
     db.SaveChanges();
     return(dondathang.SoDH);
 }
Пример #5
0
 //Thêm khách hàng mới
 public int InsertKH(KHACHHANG entity)
 {
     db.KHACHHANGs.Add(entity);
     db.SaveChanges();
     return(entity.MaKH);
 }