public ActiveUserJsonModel GetActiveUserModel(int id, DataFilter filter, ActiveUserJsonModelBuilderOptions options) { var result = new ActiveUserJsonModel(); if (filter.Period == FilteringPeriod.Other && filter.DateRange.From > filter.DateRange.To) { return(result); } var activeUsers = this.metricsService.GetUserMetrics(id, DateRangeConverter.GetDateRange(filter), options.UserTableCount); var usersList = activeUsers.MostActiveUsers.Take(options.ReportCount).ToList(); var usersListIds = usersList.Select(u => u.Id).ToArray(); var users = new ActiveUserViewModel(activeUsers); if (users.MostActiveUsers.Count != 0) { result.Table = this.GetTable(users.MostActiveUsers.ToList()); result.InterestsData = this.GetInterests(id, usersListIds, options.InterestCount); result.AgeData = this.GetAgeInfo(id, usersList); result.GenderData = this.GetGenderInfo(id, usersList); result.EducationData = this.GetEducationInfo(id, usersList); result.CountryAndCityData = this.GetCountryAndCityInfo(id, usersListIds); } result.Table = this.GetTable(users.MostActiveUsers.ToList()); return(result); }
public IActionResult MakeRequest() { var usr = authService.GetAuthUser(Request, Response); if (usr == null) { return(authService.UnAuthenticatedResult); } var model = new ActiveUserViewModel() { User = usr }; return(View(model)); }