/// <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."); } }
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() })); }
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) })); }
/// <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."); } }
/// <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."); } }
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)); }
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))); }
public async Task <IEnumerable <Project> > All() => await _projectRepository.All();