Esempio n. 1
0
        public void WhenADevsDetailsAreChanged_TheDatabaseIsUpdated()
        {
            using (var db = new GameMarketContext())
            {
                _crudMethods.Create("Bethesda");

                _crudMethods.Update("Bethesda", "Bethesda Softworks");

                var updatedCustomer = db.Developers.Where(d => d.DeveloperName == "Bethesda Softworks").FirstOrDefault();
                Assert.AreEqual("Bethesda Softworks", updatedCustomer.DeveloperName);
            }
        }
Esempio n. 2
0
        private void Btn_Click(object sender, RoutedEventArgs e)
        {
            Button btnClick = (Button)sender;

            if (btnClick.Name == "createBtn")
            {
                if (devCreateBox.Text != "")
                {
                    if (_genreManager.Create(devCreateBox.Text))
                    {
                        MessageBox.Show("Developer Created Successfully");
                        devCreateBox.Text = "";
                        PopulateListBox();
                    }
                    else
                    {
                        MessageBox.Show("Duplicate Value Entered - Value not added");
                    }
                }
                else
                {
                    MessageBox.Show("Input box empty - input valid value");
                }
            }
            else if (btnClick.Name == "deleteBtn")
            {
                if (devDeleteBox.Text != "")
                {
                    _genreManager.Delete(_genreManager.developerUpdate.DeveloperName);
                    MessageBox.Show("Developer Deleted Successfully");
                    devCreateBox.Text  = "";
                    devDeleteBox.Text  = "";
                    devUpdateText.Text = "";
                    PopulateListBox();
                }
                else
                {
                    MessageBox.Show("Not Genre Select - Select genre to delete");
                }
            }
            else if (btnClick.Name == "updateBtn")
            {
                if (devUpdateText.Text != "")
                {
                    if (_genreManager.Update(_genreManager.developerUpdate.DeveloperName, devUpdateText.Text))
                    {
                        MessageBox.Show("Developer Update Successfully");
                        devCreateBox.Text  = "";
                        devDeleteBox.Text  = "";
                        devUpdateText.Text = "";
                        PopulateListBox();
                    }
                    else
                    {
                        MessageBox.Show("New Developer entered already exists");
                    }
                }
                else
                {
                    MessageBox.Show("Not Developer Select - Select genre to update");
                }
            }
        }