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 HiphopEdit.xaml
    /// </summary>
    public partial class HiphopEdit : Window
    {
        InteractiveKioskEntities db = new InteractiveKioskEntities();
        public HiphopEdit()
        {
            InitializeComponent();
            string Hiphop = "Хип-Хоп";
            var SelectedHiphop = db.Attractions.SingleOrDefault(a => a.AttractionName == Hiphop);
            DescriptionHiphop.Text = SelectedHiphop.DescriptionOfTheAttraction;
            string Hiphop1 = "Хип-Хоп";
            var SelectedHiphop1 = db.Attractions.SingleOrDefault(a => a.AttractionName == Hiphop1);
            Rules.Text = SelectedHiphop1.RulesOfAttraction;

        }

        private void Save(object sender, RoutedEventArgs e)
        {
            var uRow = db.Attractions.FirstOrDefault();
            uRow.DescriptionOfTheAttraction = DescriptionHiphop.Text;
            uRow.RulesOfAttraction = Rules.Text;
            uRow.AttractionCost = Convert.ToInt32(PriceHiphop.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();
        }
    }
}
