public SpyStatisticsModel GetAllTimeSpyStatistics(SpyStatisticsList allStatistics) { long accountId = 0; var updateDateTime = new DateTime(); var accountStatisticsModel = allStatistics.StatisticsList.OrderByDescending(model => model.DateTimeUpdateStatistics).FirstOrDefault(); if (accountStatisticsModel == null) { return new SpyStatisticsModel { CountAnalizeFriends = allStatistics.StatisticsList.Sum(model => model.CountAnalizeFriends), SpyAccountId = accountId, CreateDateTime = DateTime.Now, DateTimeUpdateStatistics = updateDateTime } } ; accountId = accountStatisticsModel.SpyAccountId; updateDateTime = accountStatisticsModel.DateTimeUpdateStatistics; return(new SpyStatisticsModel { CountAnalizeFriends = allStatistics.StatisticsList.Sum(model => model.CountAnalizeFriends), SpyAccountId = accountId, CreateDateTime = DateTime.Now, DateTimeUpdateStatistics = updateDateTime }); } }
public SpyStatisticsModel GetLastHourSpyStatistics(SpyStatisticsList allStatistics) { return(allStatistics.StatisticsList.OrderByDescending(model => model.CreateDateTime).FirstOrDefault()); }