示例#1
0
        public async Task <ActionResult> LanguageFluencyLevel(Guid languagecandidateId, [FromBody] FluencyLevel fluencyLevelRating)
        {
            if (!fluencyLevelRating.Validate())
            {
                NotifierError("Nivel de fluencia inválido.");
                return(CustomResponse());
            }
            if (languagecandidateId == Guid.Empty)
            {
                NotifierError("Id invalido.");
                return(CustomResponse());
            }

            var languageCandidate = await GetCandidateLanguageById(languagecandidateId);

            if (languageCandidate == null)
            {
                NotifierError("Idioma inválido");
                return(CustomResponse());
            }
            if (languageCandidate.CandidateId != _candidateId)
            {
                NotifierError("Esse registro não pertence ao usuário logado.");
                return(CustomResponse());
            }

            var command  = new UpdateLanguageFluencyLevelCommand(languagecandidateId, _candidateId, fluencyLevelRating);
            var response = await _mediatorHandler.SendCommand(command);

            if (!response.IsValid)
            {
                return(CustomResponse(response));
            }

            return(CustomResponse(await GetCandidateLanguageById(languagecandidateId)));
        }
示例#2
0
 private bool FluencyLevelValidate(FluencyLevel fluencyLevel)
 {
     return(fluencyLevel.Validate());
 }