public IEnumerable <Users> GetUserbyHeader(string email, string token) { object[] args = new object[] { email, token }; string query = string.Format("SELECT * FROM users WHERE email = '{0}' AND remember_token = '{1}'", args); DataContextFetch dcf = new DataContextFetch(); DataRow dr = dcf.Get(query); var id = Int32.Parse(dr["id"].ToString()); var user = new Users { }; if (id > 0) { user = new Users { id = Int32.Parse(dr["id"].ToString()), name = dr["name"].ToString(), email = dr["email"].ToString(), password = dr["password"].ToString(), remember_token = dr["remember_token"].ToString(), is_active = Int32.Parse(dr["is_active"].ToString()) }; } yield return(user); }
public IEnumerable <Users> GetUser(string email) { string query = string.Format("SELECT * FROM users WHERE email = '{0}'", email); DataContextFetch dcf = new DataContextFetch(); DataRow dr = dcf.Get(query); var user = new Users { id = Int32.Parse(dr["id"].ToString()), name = dr["name"].ToString(), email = dr["email"].ToString(), password = dr["password"].ToString(), remember_token = dr["remember_token"].ToString(), is_active = Int32.Parse(dr["is_active"].ToString()) }; yield return(user); }
public IEnumerable <Members> GetMemberbyId(string id) { string query = string.Format("SELECT * FROM members WHERE id = {0}", id); DataContextFetch dcf = new DataContextFetch(); DataRow dr = dcf.Get(query); var member = new Members { id = Int32.Parse(dr["id"].ToString()), title = dr["title"].ToString(), name = dr["name"].ToString(), first_nric = dr["first_nric"].ToString(), no_nric = dr["no_nric"].ToString(), last_nric = dr["last_nric"].ToString(), no_mobile = dr["no_mobile"].ToString(), email = dr["email"].ToString(), postal_code = dr["postal_code"].ToString(), promo_code = dr["promo_code"].ToString(), created_at = dr["created_at"].ToString(), updated_at = dr["updated_at"].ToString() }; yield return(member); }