//Sets season to autumn. public void SetAutumnSeason() { WeatherView autumnStartDate = GetAutumnStartDate(); if (autumnStartDate != default) { db.WeatherViewData .Where(d => d.Date.Date >= autumnStartDate.Date) .ToList() .ForEach(v => v.Season = "Höst"); db.SaveChanges(); } }
//Sets season to winter. public void SetWinterSeason() { WeatherView winterStartDate = GetWinterStartDate(); if (winterStartDate != default) { db.WeatherViewData .Where(d => d.Date.Date > winterStartDate.Date) .ToList() .ForEach(v => v.Season = "Vinter"); db.SaveChanges(); } }
//Set season to summer. public void SetSummerSeason() { WeatherView summerStartDate = GetSummerStartDate(); if (summerStartDate != default) { db.WeatherViewData .Where(d => d.Date.Date >= summerStartDate.Date) .ToList() .ForEach(v => v.Season = "Sommar"); db.SaveChanges(); } }
//Get stats for one date. public WeatherView GetStatFromDate(WeatherView view) { if (view == null) { return(default);