Example #1
0
 private User ReadUser(SQLiteDataReader reader)
 {
     User user = new User
     {
         Name = reader.Fetch<string>("Name"),
         CreatedOn = reader.Fetch<DateTime>("CreatedOn")
     };
     
     return user;
 }
        public void VerifyUserProperties()
        {
            User user = new User
            {
                ID = 1,
                Name = "Homer Simpson",
                Password = "******",
                CreatedBy = 1,
                CreatedOn = DateTime.Now,
                ModifiedBy = 1,
                ModifiedOn = DateTime.Now
            };

            Assert.IsNotNull(user);
        }
Example #3
0
        public User GetUserByID(int id)
        {
            const string sqlQuery = "SELECT Name, CreatedOn " +
                                    "FROM User " +
                                    "WHERE ID = @id";

            User user = new User();

            using (var reader = DbUtil.ExecuteReader(sqlQuery, new SQLiteParameter("@id", id)))
            {
                if (reader.Read())
                {
                    user = ReadUser(reader);
                }
            }

            user.ID = id;

            return user;
        }