using System.Linq;
using System.Windows;
using System.Windows.Controls;

namespace Hotel_Course_Project
{
    /// <summary>
    /// Логика взаимодействия для RoomAddOrChangePage.xaml
    /// </summary>
    public partial class RoomAddOrChangePage : Page
    {
        public RoomAddOrChangePage(Room room)
        {
            InitializeComponent();
            DataContext = room;
            RStatus.ItemsSource = DataBase.db.RoomStatus.ToList();
            if (DataContext != null)
            {
                RStatus.Text = room.ToString();
                AddBtn.Content = "Изменить данные о комнате";
            }
        }

        private void CancelBtn_Click(object sender, RoutedEventArgs e)
        {
            PChanger.MainFrame.GoBack();
        }

        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            DataBase.db.SaveChanges();
            PChanger.MainFrame.GoBack();
        }
    }
}
