public int InsertProduct(Product p) { try { db.Products.InsertOnSubmit(p); db.SubmitChanges(); } catch { return -1; } return 1; }
public int UpdateProduct(Product p) { try { Product pp = db.Products.Single(n => n.id == p.id); pp.tensp = p.tensp; pp.dongia = p.dongia; pp.taydai = p.taydai; pp.idbrand = p.idbrand; pp.idloai = p.idloai; pp.idchatlieu = p.idchatlieu; pp.image1 = p.image1; pp.image2 = p.image2; pp.image3 = p.image3; pp.trangthai = p.trangthai; db.SubmitChanges(); } catch { return -1; } return 1; }
partial void DeleteProduct(Product instance);
partial void UpdateProduct(Product instance);
partial void InsertProduct(Product instance);
private void detach_Products(Product entity) { this.SendPropertyChanging(); entity.Type = null; }
private void attach_Products(Product entity) { this.SendPropertyChanging(); entity.Type = this; }