public static IEnumerable <AllActorsNotInVM> GetAllActorsNotIn(int intShowID) { List <AllActorsNotInVM> retval = new List <AllActorsNotInVM>(); // create and open a connection NpgsqlConnection conn = DatabaseConnection.GetConnection(); conn.Open(); // Define a query string query = "SELECT DISTINCT m.\"intMemberID\"" + " FROM members m, casts c" + " WHERE m.\"intMemberID\" = c.\"intMemberID\" " + " EXCEPT(SELECT m2.\"intMemberID\" " + " FROM members m2, shows s, casts c2" + " WHERE m2.\"intMemberID\" = c2.\"intMemberID\"" + " AND c2.\"intShowID\" = s.\"intShowID\"" + " AND s.\"intShowID\" = " + intShowID + ")"; NpgsqlCommand cmd = new NpgsqlCommand(query, conn); // Execute a query NpgsqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { int id = Convert.ToInt32(dr["intMemberID"]); AllActorsNotInVM tmpActorNotIn = AllActorsNotInVM.Of(id); retval.Add(tmpActorNotIn); } conn.Close(); return(retval); }
public ActionResult GetAllActorsNotIn(int intShowID) { AllActorsNotInVM model = new AllActorsNotInVM() { LstAllShows = ShowsDAL.GetAllShows(), LstAllActorsNotIn = AnalyticsDAL.GetAllActorsNotIn(intShowID), Show = ShowsDAL.GetShow(intShowID) }; return(PartialView("AnalyticsPartials/_AllActorsNotIn", model)); }