public void AddSessionForThisClient(Client client) { var history = new History { Client = client, Record = DateTime.Now }; HistoriesRepository.AddAsync(history); }
public ICollection <History> SessiosOfThisMonthForThisClient(Client client) { var subcribtions = SubcriptionsRepository.Get(e => e.Client.Id == client.Id).ToList(); var subcribtion = subcribtions.FirstOrDefault(e => (e.EndDate - DateTime.Now).TotalDays > 0); var sessionsofthisClient = HistoriesRepository.Get(n => n.Client.Id == client.Id).ToList(); var sessions = sessionsofthisClient.Where(n => subcribtion != null && n.Record >= subcribtion.StartDate && n.Record <= subcribtion.EndDate) .ToList(); return(sessions); }
public ICollection <History> GetHistory(DateTime startDate, DateTime endDate) { return(HistoriesRepository.Get(n => n.Record >= startDate && n.Record <= endDate).ToList()); }