Ejemplo n.º 1
0
        public async Task AddNewCandidateAsync_CreateCandidateResourceAsParam_CreatedCandidateResourceReturned()
        {
            var newCandidate      = GetNewCandidate();
            var expectedCandidate = GetExpectedCandidate();

            var addedCandidate = await _service.AddCandidateAsync(newCandidate);

            AssertCandidates(expectedCandidate, addedCandidate);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> AddCandidateAsync([FromBody] CreateCandidateResource createCandidateResource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var newCandidate = await _candidateService.AddCandidateAsync(createCandidateResource);

            if (newCandidate == null)
            {
                return(BadRequest());
            }
            return(Ok(newCandidate));
        }