public async Task Reset(DateTime from, DateTime to) { // Reset based on day var days = await dayRepository.GetDays(from, to); var pings = new List <Ping>(); foreach (var day in days) { pings = await pingRepository.GetPings(day); await ResetPings(pings); if (day.RideId != null) { var ride = await rideRepository.GetByIdFull((int)day.RideId); await ResetPings(ride.Pings.ToList()); rideRepository.Delete(day.RideId); await rideRepository.SaveAsync(); } dayRepository.Delete(day.Id); } await dayRepository.SaveAsync(); // Reset the remaining pings pings = await pingRepository.GetBetweenDates(from, to); await ResetPings(pings); cache.ClearCache(); }
public async Task <IActionResult> Index(string date = "") { var _date = DateFunctions.GetDate(date); var days = await dayRepository.GetDays(_date, _date.AddDays(1).AddMinutes(-1)); ViewBag.Date = _date; ViewBag.Note = await noteRepository.GetNote(_date); return(View(days)); }