public void Update(DS_Products Products) { using (var ct = new DS_ProductsDataContext(DbHelperSQL.Connection)) { ct.DS_Products.Attach(Products, true); ct.SubmitChanges(); } }
public void Add(DS_Products Products) { using (var ct = new DS_ProductsDataContext(DbHelperSQL.Connection)) { ct.DS_Products.InsertOnSubmit(Products); ct.SubmitChanges(); } }
public void Delete(int ID) { using (var ct = new DS_ProductsDataContext(DbHelperSQL.Connection)) { var st = ct.DS_Products.Single(a => a.ID == ID); ct.DS_Products.DeleteOnSubmit(st); ct.SubmitChanges(); } }
public void Delete(string Ids) { using (var ct = new DS_ProductsDataContext(DbHelperSQL.Connection)) { string[] idarray = Ids.Split(','); var list = ct.DS_Products.Where(a => idarray.Contains(a.ID.ToString())); ct.DS_Products.DeleteAllOnSubmit(list); ct.SubmitChanges(); } }