using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace InteractiveKiosk.Attractions
{
    /// <summary>
    /// Interaction logic for KamikadzeEdit.xaml
    /// </summary>
    public partial class KamikadzeEdit : Window
    {
        InteractiveKioskEntities db = new InteractiveKioskEntities();
        public KamikadzeEdit()
        {
            InitializeComponent();
            string Kamikadze = "Камикадзе";
            var SelectedKamikadze = db.Attractions.SingleOrDefault(a => a.AttractionName == Kamikadze);
            DescriptionKamikadze.Text = SelectedKamikadze.DescriptionOfTheAttraction;
            string Kamikadze1 = "Камикадзе";
            var SelectedKamikadze1 = db.Attractions.SingleOrDefault(a => a.AttractionName == Kamikadze1);
            Rules.Text = SelectedKamikadze1.RulesOfAttraction;

        }

        private void Save(object sender, RoutedEventArgs e)
        {
            var uRow = db.Attractions.FirstOrDefault(); 
            uRow.DescriptionOfTheAttraction = DescriptionKamikadze.Text; 
            uRow.RulesOfAttraction = Rules.Text;
            uRow.AttractionCost = Convert.ToInt32(PriceKamikadze.Text);
            db.SaveChanges();
        }

        private void MinButton_MouseDown(object sender, MouseButtonEventArgs e)
        {
             this.WindowState = WindowState.Minimized;
        }

        private void ExitButton_MouseDown(object sender, MouseButtonEventArgs e)
        {
            this.Close();
        }

        private void BackButton_MouseDown(object sender, MouseButtonEventArgs e)
        {
            AttractionsWindow aw = new AttractionsWindow();
            aw.Show();
            this.Close();
        }
    }
}
