public static void deleteSharedContactById(int id) { using (DBA.Baas.ProductionDataContext db = new DBA.Baas.ProductionDataContext()) { var result = (from x in db.JagatudContacts where x.ID == id select x).FirstOrDefault(); db.JagatudContacts.DeleteOnSubmit(result); db.SubmitChanges(); } }
public static void deleteUserPermanentlyById(int id) { using (DBA.Baas.ProductionDataContext db = new DBA.Baas.ProductionDataContext()) { var query = (from x in db.Users where x.ID == id select x).FirstOrDefault(); db.Users.DeleteOnSubmit(query); db.SubmitChanges(); } }
public static void addSharedContact(SContact scont) { using (DBA.Baas.ProductionDataContext db = new DBA.Baas.ProductionDataContext()) { DBA.Baas.JagatudContact newSharedContact = scont.mapToDbJagatudContact(); db.JagatudContacts.InsertOnSubmit(newSharedContact); db.SubmitChanges(); } }
public static void addUser(User user) { using (DBA.Baas.ProductionDataContext db = new DBA.Baas.ProductionDataContext()) { DBA.Baas.User newUser = user.mapToDbUser(); newUser.Loodud = System.DateTime.Now; db.Users.InsertOnSubmit(newUser); db.SubmitChanges(); } }
public static void deleteUserByid(int id) { using (DBA.Baas.ProductionDataContext db = new DBA.Baas.ProductionDataContext()) { var query = (from x in db.Users where x.ID == id select x).FirstOrDefault(); if (query != null) { query.Kustutatud = DateTime.Now; db.SubmitChanges(); } } }
public static void updateUser(User usr) { using (DBA.Baas.ProductionDataContext db = new DBA.Baas.ProductionDataContext()) { var query = (from x in db.Users where x.ID == usr.Id select x).FirstOrDefault(); if (query != null) { query = usr.mapToDbUser(); query.Muudetud = DateTime.Now; db.SubmitChanges(); } } }