StatisticsService.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Security.Principal;
  3. using System.Threading.Tasks;
  4. using BO.AppServer.Data.Entity;
  5. using BO.AppServer.Data.Repository;
  6. using BO.AppServer.Metadata.Dto;
  7. using BO.AppServer.Business.Mapper;
  8. using Microsoft.Extensions.Logging;
  9. using Quadarax.Foundation.Core.Business;
  10. using Quadarax.Foundation.Core.Data.Interface.Entity.Dto;
  11. namespace BO.AppServer.Business.Services
  12. {
  13. public class StatisticsService : AbstractService
  14. {
  15. #region *** Private fields ***
  16. protected StatisticRepo _repoStatistic;
  17. protected UserRepo _repoUser;
  18. #endregion
  19. #region *** Constructor & DI ***
  20. public StatisticsService(
  21. StatisticRepo repoStatistic,
  22. UserRepo repoUser,
  23. IPrincipal currentPrincipal,
  24. ILoggerFactory logger) : base(currentPrincipal, logger)
  25. {
  26. _repoStatistic = repoStatistic ?? throw new ArgumentNullException(nameof(repoStatistic));
  27. _repoUser = repoUser ?? throw new ArgumentNullException(nameof(repoUser));
  28. }
  29. #endregion
  30. #region *** Public Operations ***
  31. public async Task<ResultValueDto<StatisticsDto>> GetCurrent()
  32. {
  33. var current = _repoStatistic.GetCurrent();
  34. return new ResultValueDto<StatisticsDto>(current.Map<Statistic, StatisticsDto>());
  35. }
  36. #endregion
  37. }
  38. }