public ActionResult EditShooter(string first, string last) { ViewBag.First = first; ViewBag.Last = last; NpgsqlConnection connection = new NpgsqlConnection(RouteConfig.connectString); connection.Open(); NpgsqlCommand command = new NpgsqlCommand("SELECT * FROM shooters.shooter Where first = '" + first + "' AND last = '" + last + "'", connection); NpgsqlDataReader dataReader = command.ExecuteReader(); NpgsqlDataAdapter da = new NpgsqlDataAdapter(); DataTable dt = new DataTable(); for (int i = 0; dataReader.Read(); i++) { } dt.Load(dataReader); da.SelectCommand = command; da.Fill(dt); var model = TableUtils.CreateObjectFromTable <actor>(dt); connection.Close(); return(View(model)); }