Beispiel #1
0
 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);
     }
 }
Beispiel #2
0
 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);
     }
 }
Beispiel #3
0
 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);
         }
     }
 }