Esempio n. 1
0
        private void InsertSender()
        {
            MovieModel movie = null;

            // Too lazy to cath user input exceprions. Catch all instead.
            try
            {
                movie = new MovieModel(
                    -1,
                    txtRating.Text,
                    txtTitle.Text,
                    txtYear.Text,
                    Convert.ToInt32(txtPrice.Text),
                    Convert.ToInt32(txtCopies.Text),
                    txtPlot.Text,
                    txtGenre.Text);

                var insert = new DatabaseOperations();
                insert.AddMovieToTable(movie);

                this.Close();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);

                Console.WriteLine($"ERROR UPDATING DATABASE:\n{exception}");
                return;
            }
        }