public async Task <IActionResult> GetQuestionFilteredStatisticsUsers( [FromBody] GetQuestionFilteredStatistics statistics) { Logger.LogInformation($"{nameof(QuestionsController)}.{nameof(GetQuestionFilteredStatisticsUsers)}.Start"); var resultDto = await MainDb.Questions.GetQuestionStatistiсUsers(statistics.UserId, statistics.QuestionId, statistics.MinAge, statistics.MaxAge, statistics.SexType, statistics.City, statistics.PageParams.Offset, statistics.PageParams.Count); var result = new QuestionStatisticUserViewModel { Voters = new List <List <VoterUserViewModel> >() }; foreach (var item in resultDto.Voters) { result.Voters.Add(item.Select(x => new VoterUserViewModel { Age = x.Age, City = x.City, IsHeFollowed = x.IsHeFollowed, IsYouFollowed = x.IsYouFollowed, Login = x.FirstName + " " + x.LastName, SexType = x.SexType, SmallAvatarUrl = MediaConverter.ToFullAvatarUrl(x.OriginalAvatarUrl, AvatarSizeType.Small), UserId = x.UserId }).ToList()); } Logger.LogInformation($"{nameof(QuestionsController)}.{nameof(GetQuestionFilteredStatisticsUsers)}.End"); return(new OkResponseResult("Question Statistic -> Users", result)); }
public async Task <IActionResult> GetQuestionFilteredStatistics([FromBody] GetQuestionFilteredStatistics statistics) { //TODO убрать if (statistics.UserId <= 0) { return(new BadResponseResult("UserId has to be more than 0")); } Logger.LogInformation($"{nameof(QuestionsController)}.{nameof(GetQuestionFilteredStatistics)}.Start"); var result = await MainDb.Questions.GetQuestionStatistic(statistics.UserId, statistics.QuestionId, statistics.MinAge, statistics.MaxAge, statistics.SexType, statistics.City); await Hub.Monitoring.UpdateUrlMonitoring(statistics.UserId, UrlMonitoringType.FiltersQuestions); Logger.LogInformation($"{nameof(QuestionsController)}.{nameof(GetQuestionFilteredStatistics)}.End"); return(new OkResponseResult("Question Statistic", result)); }