Example #1
0
 public WeatherInfo GetWeatherInfo(int id)
 {
     try
     {
         WeatherInfo weather = db.WeatherInfo.Find(id);
         return(weather);
     }
     catch
     {
         throw;
     }
 }
Example #2
0
        public int UpdateWeather(WeatherInfo weather)
        {
            try
            {
                db.Entry(weather).State = EntityState.Modified;
                db.SaveChanges();

                return(1);
            }
            catch
            {
                throw;
            }
        }
Example #3
0
 public int AddWeatherInfo(WeatherInfo weather)
 {
     try
     {
         db.WeatherInfo.Add(weather);
         db.SaveChanges();
         return(1);
     }
     catch
     {
         System.Diagnostics.Trace.WriteLine(weather);
         throw;
     }
 }
Example #4
0
 public int DeleteWeatherInfo(int id)
 {
     try
     {
         WeatherInfo emp = db.WeatherInfo.Find(id);
         db.WeatherInfo.Remove(emp);
         db.SaveChanges();
         return(1);
     }
     catch
     {
         throw;
     }
 }