Exemple #1
0
        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();
        }
Exemple #2
0
        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();
        }
Exemple #3
0
        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);
        }
Exemple #4
0
 public Rating()
 {
     movie    = new Movie();
     reviewer = new Reviewer();
 }