예제 #1
0
        /// <summary>
        /// Runs the project updater task. Updates cached information for all projects in the database.
        /// </summary>
        public void Run()
        {
            var projects = _projectRepository.All();

            foreach (var project in projects)
            {
                Console.Write("Updating '{0}'... ", project.Name);
                _projectUpdater.UpdateProject(project);
                Console.WriteLine("Done.");
            }
        }
예제 #2
0
 public virtual ActionResult Sitemap()
 {
     Response.ContentType = "text/xml";
     return(View(new SitemapViewModel
     {
         Posts = _blogRepository.LatestPostsSummary(10000),                 // Should be big enough, lols
         Categories = _blogRepository.Categories(),
         Tags = _blogRepository.Tags(),
         Projects = _projectRepository.All()
     }));
 }
예제 #3
0
        public virtual ActionResult Index()
        {
            var projects = _projectRepository.All();
            var techs    = _projectRepository.Technologies();

            return(View("Index", new IndexViewModel
            {
                CurrentProjects = projects.Where(x => x.IsCurrent).ToList(),
                PreviousProjects = projects.Where(x => !x.IsCurrent).ToList(),
                PrimaryTechnologies = techs.Where(x => x.IsPrimary).ToList(),
                Technologies = techs.ToDictionary(x => x.Slug)
            }));
        }
예제 #4
0
        /// <summary>
        /// Runs the project updater task. Updates cached information for all projects in the database.
        /// </summary>
        public async Task RunAsync()
        {
            var projects = _projectRepository.All();

            foreach (var project in projects)
            {
                Console.Write("Updating '{0}'... ", project.Name);
                // TODO: This can be parallelised
                await _projectUpdater.UpdateProjectAsync(project);

                Console.WriteLine("Done.");
            }
        }
예제 #5
0
        /// <summary>
        /// Runs the project updater task. Updates cached information for all projects in the database.
        /// </summary>
        public async Task RunAsync()
        {
            var projects = _projectRepository.All();

            foreach (var project in projects)
            {
                _logger.LogInformation("Updating '{0}'... ", project.Name);
                // TODO: This can be parallelised
                await _projectUpdater.UpdateProjectAsync(project);

                _logger.LogInformation("Done.");
            }
        }
예제 #6
0
        public async Task <ProjectsListViewModel> Handle(GetAllProjectsQuery request, CancellationToken cancellationToken)
        {
            // Example logging call
            Log.Information("Projects called");
            // Use async calls if possible
            var projects = _repository.All().Select(ProjectDto.Projection).ToList();

            var model = new ProjectsListViewModel
            {
                Projects = projects,
                Today    = _dt.Now.ToString("dd.MM.yyyy")
            };

            // Use Task.FromResult to disable warning
            return(await Task.FromResult(model));
        }
예제 #7
0
        private IQueryable <Project> SecureQuery()
        {
            var currentUser = _userRepository.Find(User.Identity.GetUserId());

            if (currentUser == null)
            {
                return(null);
            }

            // access to organizations or user id
            var access = currentUser.Organizations;

            access.Add(currentUser.Id);

            return(_projectRepository.All()
                   .Where(t => access.Contains(t.OrganizationId)));
        }
예제 #8
0
 public async Task <IEnumerable <Project> > All() => await _projectRepository.All();