Exemple #1
0
        public async Task <IActionResult> CreateNewElection(CreateNewElectionRequest request)
        {
            var newElection     = new Election(request.Date, request.Description);
            var createdElection = await _electionService.CreateElection(newElection);

            var response = new ElectionCreatedResponse
            {
                Id = createdElection.Id
            };

            return(CreatedAtAction(nameof(GetElectionById), new { id = createdElection.Id }, response));
        }