2020-12-30 01:58:08 -05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using BirdsiteLive.DAL.Contracts;
|
2021-01-12 23:53:23 -05:00
|
|
|
|
using BirdsiteLive.Statistics.Domain;
|
2020-12-30 01:58:08 -05:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
|
|
namespace BirdsiteLive.Controllers
|
|
|
|
|
{
|
|
|
|
|
public class StatisticsController : Controller
|
|
|
|
|
{
|
|
|
|
|
private readonly ITwitterUserDal _twitterUserDal;
|
|
|
|
|
private readonly IFollowersDal _followersDal;
|
2021-01-12 23:53:23 -05:00
|
|
|
|
private readonly ITwitterStatisticsHandler _twitterStatistics;
|
2020-12-30 01:58:08 -05:00
|
|
|
|
|
|
|
|
|
#region Ctor
|
2021-01-12 23:53:23 -05:00
|
|
|
|
public StatisticsController(ITwitterUserDal twitterUserDal, IFollowersDal followersDal, ITwitterStatisticsHandler twitterStatistics)
|
2020-12-30 01:58:08 -05:00
|
|
|
|
{
|
|
|
|
|
_twitterUserDal = twitterUserDal;
|
|
|
|
|
_followersDal = followersDal;
|
2021-01-12 23:53:23 -05:00
|
|
|
|
_twitterStatistics = twitterStatistics;
|
2020-12-30 01:58:08 -05:00
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public async Task<IActionResult> Index()
|
|
|
|
|
{
|
2021-01-12 23:53:23 -05:00
|
|
|
|
var stats = new Models.StatisticsModels.Statistics
|
2020-12-30 01:58:08 -05:00
|
|
|
|
{
|
|
|
|
|
FollowersCount = await _followersDal.GetFollowersCountAsync(),
|
2021-01-12 23:53:23 -05:00
|
|
|
|
TwitterUserCount = await _twitterUserDal.GetTwitterUsersCountAsync(),
|
|
|
|
|
TwitterStatistics = _twitterStatistics.GetStatistics()
|
2020-12-30 01:58:08 -05:00
|
|
|
|
};
|
|
|
|
|
return View(stats);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|