public void Delete(Func <WeatherInfo, bool> criteria) { using (var context = new LeafletWeatherModel()) { context.Set <WeatherInfo>().Remove(context.Set <WeatherInfo>().SingleOrDefault(criteria)); context.SaveChanges(); } }
public WeatherInfo Update(WeatherInfo entity) { using (var context = new LeafletWeatherModel()) { var result = context.Set <WeatherInfo>().Attach(entity); context.Entry(entity).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return(result); } }