Beispiel #1
0
 public bool InsertNewProduct(string name, float cost, string pic, string direc)
 {
     try
     {
         SanPhamDBDataContext db = new SanPhamDBDataContext();
         SANPHAM sp = new SANPHAM();
         sp.TENSP   = name;
         sp.DONGIA  = cost;
         sp.HINHANH = pic;
         sp.CHITIET = direc;
         db.SANPHAMs.InsertOnSubmit(sp);
         db.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Beispiel #2
0
        public SANPHAM GetPro(string id)
        {
            SanPhamDBDataContext db = new SanPhamDBDataContext();

            return(db.SANPHAMs.FirstOrDefault(x => x.MASP == id));
        }
Beispiel #3
0
        public List <SANPHAM> GET()
        {
            SanPhamDBDataContext db = new SanPhamDBDataContext();

            return(db.SANPHAMs.ToList());
        }