Exemple #1
0
        public ActionResult ControlPanel()
        {
            ControlPanelViewData viewData = new ControlPanelViewData();

            if (!IsCurrentUserAuthenticated || !CurrentUser.CanModerate())
            {
                viewData.ErrorMessage = "You do not have the privilege to view it.";
            }
            else
            {
                viewData.IsAdministrator = CurrentUser.IsAdministrator();
                viewData.NewCount        = _storyRepository.CountByNew();
                viewData.UnapprovedCount = _storyRepository.CountByUnapproved();

                DateTime currentTime = SystemTime.Now();
                DateTime minimumDate = currentTime.AddHours(-Settings.MaximumAgeOfStoryInHoursToPublish);
                DateTime maximumDate = currentTime.AddHours(-Settings.MinimumAgeOfStoryInHoursToPublish);

                viewData.PublishableCount = _storyRepository.CountByPublishable(minimumDate, maximumDate);
            }

            return(View(viewData));
        }
        public ActionResult ControlPanel()
        {
            ControlPanelViewData viewData = new ControlPanelViewData();

            if (!IsCurrentUserAuthenticated || !CurrentUser.CanModerate())
            {
                viewData.ErrorMessage = "Nie masz uprawnień do oglądania tej części strony.";
            }
            else
            {
                viewData.IsAdministrator = CurrentUser.IsAdministrator();
                viewData.NewCount        = _storyRepository.CountByNew();
                viewData.UnapprovedCount = _storyRepository.CountByUnapproved();

                DateTime currentTime = SystemTime.Now();
                DateTime minimumDate = RoundDown(currentTime.AddHours(-Settings.MaximumAgeOfStoryInHoursToPublish), TimeSpan.FromMinutes(15));
                DateTime maximumDate = RoundDown(currentTime.AddHours(-Settings.MinimumAgeOfStoryInHoursToPublish), TimeSpan.FromMinutes(15));

                viewData.PublishableCount      = _storyRepository.CountByPublishable(minimumDate, maximumDate);
                viewData.UnapprovedEventsCount = _upcommingEventsReposiotory.CountByUnapproved();
            }

            return(View(viewData));
        }
Exemple #3
0
 public virtual int CountByUnapproved()
 {
     return(_innerRepository.CountByUnapproved());
 }