Esempio n. 1
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ValidateValues();
                UpdateFormular();
                formularService.UpdateFormular(formular);    //nu se actualizeaza in baza de date....

                using (RoomsContext roomsContext = new RoomsContext())
                {
                    var newStare = roomsContext.Formular.Max(x => x.StareFormular);

                    var returnedFormular = roomsContext.Formular.Where(x => x.StareFormular == newStare).ToString();


                    roomsContext.SaveChanges();
                }

                this.Close();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
Esempio n. 2
0
 public MainWindow()
 {
     InitializeComponent();
     using (var context = new RoomsContext())
     {
         var Rol_Utilizator = new Rol_Utilizator
         {
             rol = "administrator"
         };
         context.Tip.Add(Rol_Utilizator);
         context.SaveChanges();
     }
 }