public void Add(Reviewer reviewer) { MySqlCommand command = new MySqlCommand("INSERT INTO Reviewer (name) VALUES(@name)", DB.MySqlConnect); command.Parameters.AddWithValue("@name", reviewer.Name); command.ExecuteNonQuery(); }
public void Update(Reviewer reviewer) { MySqlCommand command = new MySqlCommand("UPDATE Reviewer SET name = @name WHERE rID = @rID", DB.MySqlConnect); command.Parameters.AddWithValue("@rID", reviewer.rID); command.Parameters.AddWithValue("@name", reviewer.Name); command.ExecuteNonQuery(); }
public IEnumerable <Reviewer> GetAll() { MySqlCommand command = new MySqlCommand("SELECT * FROM Reviewer", DB.MySqlConnect); MySqlDataReader reader = command.ExecuteReader(); List <Reviewer> list = new List <Reviewer>(); Reviewer reviewer; while (reader.Read()) { reviewer = new Reviewer { rID = Convert.ToInt32(reader[0]), Name = Convert.ToString(reader[1]) }; list.Add(reviewer); } return(list); }
public Rating() { movie = new Movie(); reviewer = new Reviewer(); }