public IEnumerable <IdeaDto> GetIdeas(string userId, int ideationId = 0) { List <Idea> ideas; if (ideationId != 0) { ideas = _ideationManager.GetIdeasForIdeation(ideationId).ToList(); } else { ideas = _ideationManager.GetIdeas().ToList(); } var dtos = _mapper.Map <List <IdeaDto> >(ideas); foreach (var idea in dtos) { var vote = _userManager.GetVoteForIdea(idea.IdeaId, userId); if (vote != null) { idea.UserVoteValue = vote.Value; } idea.Comments = _commentsHelper.GetCommentsForIdea(idea.IdeaId, userId); } return(dtos); }
public IActionResult Index() { IEnumerable <Idea> ideas = _ideationManager.GetIdeas(); return(View(ideas)); }