コード例 #1
0
        public IEnumerable <IdeationDto> GetIdeations(string userId, int phaseId = 0)
        {
            IEnumerable <Ideation> ideations;

            if (phaseId != 0)
            {
                ideations = _projectManager.GetProjectPhase(phaseId).Ideations;
            }
            else
            {
                ideations = _ideationManager.GetIdeations().ToList();
            }
            var dtos = _mapper.Map <IEnumerable <IdeationDto> >(ideations);

            foreach (var ideation in dtos)
            {
                var vote = _userManager.GetVoteForIdeation(ideation.IdeationId, userId);
                if (vote != null)
                {
                    ideation.UserVoteValue = vote.Value;
                }
            }

            return(dtos);
        }
コード例 #2
0
ファイル: AdminController.cs プロジェクト: ka2ya/cityOfIdeas
        // GET
        public IActionResult Dashboard(
            [FromServices] IPlatformManager platformManager,
            [FromServices] IProjectManager projectManager,
            [FromServices] IIdeationManager ideationManager,
            [FromServices] UserManager <User> userManager
            )
        {
            ViewBag.TotalPlatforms = platformManager.GetPlatforms().Count();
            ViewBag.TotalProjects  = projectManager.GetProjects().Count();
            ViewBag.TotalIdeations = ideationManager.GetIdeations().Count();

            ViewBag.TotalVotes         = ideationManager.GetTotalVoteCount();
            ViewBag.TotalUsers         = userManager.Users.Count();
            ViewBag.TotalOrganisations = userManager.GetUsersForClaimAsync(new Claim("Organisation", "Organisation")).Result.Count;

            return(View());
        }
コード例 #3
0
        public IActionResult GetIdeations()
        {
            var ideations = _ideationManager.GetIdeations();

            var subdomain = GetSubdomain(HttpContext.Request.Host.ToString());

            if (subdomain != null)
            {
                ideations = ideations.Where(p => p.Project.Platform.Tenant == subdomain).AsEnumerable();
            }

            if (ideations == null || !ideations.Any())
            {
                return(NotFound("er zijn geen ideations teruggevonden"));
            }

            return(Ok(ideations));
        }