//Add To DB Table public bool AddDB(DB d) { try { db.DBs.InsertOnSubmit(d); db.SubmitChanges(); return true; } catch (Exception error) { return false; } }
//Edit DB Table public int EditDB(DB d) { try { var v = from i in db.DBs where i.dbCode == d.dbCode select i; DB newdb = v.FirstOrDefault(); if(newdb != null) { newdb = d; db.SubmitChanges(); return 1; } return 0;//not found } catch (Exception error) { return -1; } }
partial void UpdateDB(DB instance);
partial void DeleteDB(DB instance);
partial void InsertDB(DB instance);