Esempio n. 1
0
        //ADDS A SPECIALTY TO A STYLIST
        public void AddSpecialty(Specialty newSpecialty)
        {
            MySqlConnection conn = DB.Connection();

            conn.Open();
            var cmd = conn.CreateCommand() as MySqlCommand;

            cmd.CommandText = @"INSERT INTO stylists_specialties (stylist_id, specialty_id) VALUES (@StylistId, @SpecialtyId);";

            MySqlParameter stylist_id = new MySqlParameter("@StylistId", _id);

            cmd.Parameters.Add(stylist_id);
            MySqlParameter specialty_id = new MySqlParameter("@SpecialtyId", newSpecialty.GetId());

            cmd.Parameters.Add(specialty_id);

            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }