Exemple #1
0
        public int Insert(LOAIAO loaiAo)
        {
            db.LOAIAOs.Add(loaiAo);
            db.SaveChanges();

            return(loaiAo.ma);
        }
Exemple #2
0
        /// <summary>
        /// Tạo tài khoản Admin
        /// false . Tồn tại username or email
        /// true. Thêm thành công
        /// </summary>
        /// <param name="user"></param>
        /// <returns>bool</returns>
        public bool Insert(QUANLY user)
        {
            var us = db.QUANLies.SingleOrDefault(x => x.username == user.username || x.email == user.email);

            if (us != null)
            {
                return(false);
            }
            else
            {
                db.QUANLies.Add(user);
                db.SaveChanges();
                return(true);
            }
        }
Exemple #3
0
        public bool Delete(int sohoadon)
        {
            try
            {
                var ddh = db.DONDATHANGs.SingleOrDefault(x => x.sohoadon == sohoadon);
                db.DONDATHANGs.Remove(ddh);
                db.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #4
0
 public bool Delete(int sohoadon)
 {
     try
     {
         var ls = db.CHITIETDATHANGs.Where(x => x.sohoadon == sohoadon).ToList();
         foreach (var item in ls)
         {
             db.CHITIETDATHANGs.Remove(item);
             db.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #5
0
 public int Insert(KHACHHANG kh)
 {
     db.KHACHHANGs.Add(kh);
     db.SaveChanges();
     return(kh.ma);
 }
Exemple #6
0
 public int Insert(LOAIHANG lh)
 {
     db.LOAIHANGs.Add(lh);
     db.SaveChanges();
     return(lh.ma);
 }
Exemple #7
0
 public int Insert(MATHANG mathang)
 {
     db.MATHANGs.Add(mathang);
     db.SaveChanges();
     return(mathang.ma);
 }