using System.Linq;
using System.Windows;

namespace Hotel_Course_Project
{
    /// <summary>
    /// Логика взаимодействия для StatusRoomAddWindow.xaml
    /// </summary>
    public partial class StatusRoomAddWindow : Window
    {
        public StatusRoomAddWindow()
        {
            InitializeComponent();
        }

        private void CancelBtn_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = false;
        }

        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            RoomStatus status = new RoomStatus()
            {
                Name = SRName.Text
            };
            DataBase.db.RoomStatus.Add(status);
            var lastId = DataBase.db.RoomStatus.OrderByDescending(item => item.Id).FirstOrDefault().Id;
            DataBase.db.SaveChanges();
            DialogResult = true;
        }
    }
}
