Esempio n. 1
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     using (var db = new dbContext.Parking())
     {
         /*using (var db2 = new dbContext.Parking())
          * {
          *  Model.ParkingModel model = new Model.ParkingModel(100, 100);
          *  var contact = new Model.Parking(1, textparkingime.Text, textpargrad.Text, comboboxpardrzava.SelectedItem.ToString(), 2, float.Parse(textparprice.Text), Int32.Parse(textparstart.Text), Int32.Parse(textparend.Text), Int32.Parse(textparkap.Text), Int32.Parse(textparfreep.Text), model);
          *  db.parking.Add(contact);
          *  //SaveChanges obavezno da se reflektuju izmjene u bazi, tek tada dolazi do komunikacije sa bazom
          *  db.SaveChanges();
          *  //reset polja za unos
          *  textparkingime.Text = string.Empty;
          *  textpargrad.Text = string.Empty;
          *  textparend.Text = string.Empty;
          *  textparkap.Text = string.Empty;
          *  textparfreep.Text = string.Empty;
          *  //refresh liste restorana
          *  ViewModel.System.parkings.Add(contact);
          * }*/
         var contact = new Model.Location {
             x = 1, y = 1
         };
         db.location.Add(contact);
         db.SaveChanges();
     }
 }
Esempio n. 2
0
        public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;

            using (var db = new dbContext.Parking())
            {
                db.Database.ApplyMigrations();
                Helper.DefaultPodaci.Initialize(db);
            }
        }