Example #1
0
        public async Task <IActionResult> AddCandidateToElection(AddCandidateToElectionRequest request)
        {
            var election = await _electionService.AddCandidateToElection(request.ElectionId, request.CandidateId);

            var response = new CandidateAddedToElectionResponse
            {
                ElectionId   = election.Id,
                CandidateIds = election.Candidacies.Select(x => x.Candidate.Id).ToArray()
            };

            return(Ok(response));
        }