public List <Employe> SelectAll() { DataTable table; using (MySqlConnection connection = DbConnection.GetConnection()) { connection.Open(); string strMysql = "SELECT * FROM Employe"; MySqlCommand command = new MySqlCommand(strMysql, connection); table = DataBaseAccesUtilities.SelectRequest(command); } return(GetListFromDataTable(table)); }
public Employe SelectById(int Id) { using (MySqlConnection connection = DbConnection.GetConnection()) { connection.Open(); string strMysql = "SELECT * FROM Employe WHERE EmployeID=@Id"; MySqlCommand command = new MySqlCommand(strMysql, connection); command.Parameters.AddWithValue("@Id", Id); DataTable table = DataBaseAccesUtilities.SelectRequest(command); if (table != null) { return(GetEntityFromDataRow(table.Rows[0])); } else { return(null); } } }