public List <UserTest> GetAllUsers() { string query = "Select * from user "; List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >(); DataSet results = ExecuteQuery(query, parameters); List <UserTest> users = new List <UserTest>(); if (results != null) { for (int x = 0; x < results.Tables[0].Rows.Count; x++) { UserTest user = DataSetParser.DataSetToUser(results, x); users.Add(user); } } return(users); }
public UserViewModel InsertUserLocationByID(long UId, long LId) { string SQL = "UPDATE [User] SET Location_ID = @Location_ID WHERE ID = @User_ID"; string SQLreturn = "SELECT * FROM [User] WHERE ID = @User_ID"; List <KeyValuePair <object, object> > parameters = new List <KeyValuePair <object, object> >(); parameters.Add(new KeyValuePair <object, object>("Location_ID", LId)); parameters.Add(new KeyValuePair <object, object>("User_ID", UId)); ExecuteQuery(SQL, parameters); List <KeyValuePair <object, object> > parameter = new List <KeyValuePair <object, object> >(); parameter.Add(new KeyValuePair <object, object>("User_ID", UId)); DataTable Result = ExecuteQuery(SQLreturn, parameter); UserViewModel User = DataSetParser.DataSetToUser(Result, 0); return(User); }