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 Day Delete(int id) { var Day = _repository.Get(id); _repository.Delete(Day); if (Commit()) { return(Day); } return(null); }