private async Task <List <OtherProjectViewModel> > GetOtherProjects(string id) { var projects = await _projectRepository.GetProjectsAsync(); var filteredProjects = projects.Where(x => x.Id != id && x.ProjectStatus == Status.Submission.ToString() && x.BudgetFirstPlace > 0).Take(7).ToList(); var otherProjects = new List <OtherProjectViewModel>(); foreach (var project in filteredProjects) { otherProjects.Add(OtherProjectViewModel.Create(project)); } return(otherProjects); }
private async Task <List <OtherProjectViewModel> > GetOtherProjects(string id) { var projects = await _projectRepository.GetProjectsAsync(); var filteredProjects = projects.Where(x => x.Id != id).OrderByDescending(p => p.ParticipantsCount).Take(5).ToList(); var otherProjects = new List <OtherProjectViewModel>(); foreach (var project in filteredProjects) { var otherProject = new OtherProjectViewModel { Id = project.Id, Name = project.Name, BudgetFirstPlace = project.BudgetFirstPlace, Members = project.ParticipantsCount }; otherProjects.Add(otherProject); } return(otherProjects); }