public bool UpdateReader(int ID, string name, string surname) { using (LinqLibraryDataContext dataContext = new LinqLibraryDataContext()) { if (dataContext.GetReader(ID) != null) { dataContext.UpdateUserName(ID, name); dataContext.UpdateUserSurname(ID, surname); return(true); } return(false); } }
public void TestUpdateUser() { using (LinqLibraryDataContext rep = new LinqLibraryDataContext(m_ConnectionString)) { rep.AddUser("airzile", "pods"); Reader airZile = rep.GetReader("airzile", "pods"); rep.UpdateUserName(airZile.reader_ID, "Stu"); rep.UpdateUserSurname(airZile.reader_ID, "GizzardLizardWizard"); airZile = rep.GetReader(airZile.reader_ID); Assert.AreEqual("Stu", airZile.reader_firstName); Assert.AreEqual(airZile.reader_surname, rep.GetReader(airZile.reader_ID).reader_surname); rep.DeleteUser(airZile.reader_ID); } }
public bool UpdateName(int id, string n) { using (LinqLibraryDataContext dataContext = new LinqLibraryDataContext()) { if (dataContext.GetReader(id) == null) { return(false); } else { dataContext.UpdateUserName(id, n); return(true); } } }