Exemple #1
0
        private static void UpdateWebsiteConfirmButton_Click(object sender, RoutedEventArgs e)
        {
            Button        button  = (Button)sender;
            List <object> data    = (List <object>)button.Tag;
            Website       website = (Website)data[0];
            TextBox       websiteRatingTextBox = (TextBox)data[1];

            string websiteRating = websiteRatingTextBox.Text;

            if (!BackEndHelper.IsNumber(websiteRating))
            {
                MessageBox.Show("Rating must be a number");
                return;
            }
            int newRating = int.Parse(websiteRating);

            website.rating = newRating;
            DataModels database = DataModels.GetInstance();


            bool done = database.UpdateWebsite(website);

            if (done)
            {
                MessageBox.Show("Website Updated successfully !");
            }
            else
            {
                MessageBox.Show("Couldn't update website");
            }
        }