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

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