Esempio n. 1
0
        public static void InsertProftoBD(SqlConnection connection, Professors newProfessor)
        {
            var _insert = "INSERT INTO Professors (Name, Title)" +
                          "Values (@Name, @Title)";
            var cmd = new SqlCommand(_insert, connection);

            cmd.Parameters.AddWithValue("Name", newProfessor.Name);
            cmd.Parameters.AddWithValue("Title", newProfessor.Title);
            cmd.ExecuteScalar();
        }
Esempio n. 2
0
        public static Professors CreateProf()
        {
            Console.WriteLine("Please enter the professor's title.");
            var pTitle = Console.ReadLine();

            Console.WriteLine("Please enter the professor's full name.");
            var pName = Console.ReadLine();

            var newProfessor = new Professors
            {
                Name  = pName,
                Title = pTitle
            };

            return(newProfessor);
        }