public void AddMeteostation(MeteoStation meteoStation)
 {
     MeteoStationDBContext msdbc = new MeteoStationDBContext();
     if (meteoStation.Name == null)
         throw new NoNamedStationException("Stacja nie ma nazwy!");
     else
     {
         msdbc.MeteoStation.Add(meteoStation);
         msdbc.SaveChanges();
     }
 }
        public void Edytuj()
        {
            MeteoStationDBContext ms = new MeteoStationDBContext();

            object item2 = GridStacje.SelectedItem;
            string name = (GridStacje.SelectedCells[0].Column.GetCellContent(item2)
                as TextBlock).Text;
            string city = (GridStacje.SelectedCells[1].Column.GetCellContent(item2)
                as TextBlock).Text;

            var q = (from a in ms.MeteoStation
                     where a.Name == name && a.LocationOfInstalation.City == city
                     select a).ToList();

            foreach (var item in q)
            {
                item.Name = Nazwa.Text;
                item.LocationOfInstalation.City = Miasto.Text;
                item.LocationOfInstalation.Province = Wojewodztwo.Text;
                item.DateOfInstalation = Convert.ToDateTime(DataInstalacji.Text);

            }
            ms.SaveChanges();
        }
        public void SaveMeasurements()
        {
            MeteoStationDBContext msdbc = new MeteoStationDBContext();

            //Liczby elementów w tych trzech listach powinny być równe, dlatego na sztywno użyłem "counta" jednej z nich
            for (int i = 0; i < TemperatureList.Count; i++)
            {
                msdbc.Temperature.Add(TemperatureList[i]);
                msdbc.Pressure.Add(PressureList[i]);
                msdbc.Wetness.Add(WetnessList[i]);
            }
            msdbc.SaveChanges();
        }
 public void AddLocation(Location location)
 {
     MeteoStationDBContext msdbc = new MeteoStationDBContext();
     msdbc.Location.Add(location);
     msdbc.SaveChanges();
 }