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 KinoPoisk
{
    /// <summary>
    /// Логика взаимодействия для AdminPanel.xaml
    /// </summary>
    public partial class AdminPanel : Window
    {
        public AdminPanel()
        {
            InitializeComponent();
        }

        private void Cansel_Click(object sender, RoutedEventArgs e)
        {
            MainMenu mainmenu = new MainMenu();
            this.Hide();
            mainmenu.Show();
        }

        private void AddFilm_Click(object sender, RoutedEventArgs e)
        {
            KinoPoiskContext context = new KinoPoiskContext();
            var film = context.Films;

            Film newFilm = new Film()
            {
                NameFilm = NameFilm.Text,
                YearFilm = Convert.ToDateTime(Year.Text),
                GanreFilm = Ganre.Text,
                Discript = Discript.Text,
                DurationFilm = Dlitelnost.Text
            };

            film.Add(newFilm);
            context.SaveChanges();

            MainMenu mainmenu = new MainMenu();
            this.Hide();
            mainmenu.Show();
        }

        private void AddSesion_Click(object sender, RoutedEventArgs e)
        {
            AddSeans addSeans = new AddSeans();
            this.Close();
            addSeans.Show();
        }
    }
}
