public ActionResult Shooter() { string connstring = RouteConfig.connectString; NpgsqlConnection connection = new NpgsqlConnection(connstring); connection.Open(); NpgsqlCommand command = new NpgsqlCommand("SELECT * FROM shooters.shooter", connection); NpgsqlDataReader dataReader = command.ExecuteReader(); NpgsqlDataAdapter da = new NpgsqlDataAdapter(); DataTable dt = new DataTable(); //for (int i = 0; dataReader.Read(); i++){} while (dataReader.Read()) { } dt.Load(dataReader); da.SelectCommand = command; da.Fill(dt); List <actor> _list = TableUtils.CreateListFromTable <actor>(dt); connection.Close(); var model = new Shooters() { }; model.Actors = _list; return(View(model)); // return View(); }