public async Task <ActionResult <Resultado> > Reply(CadastroQuestionarioRespostaViewModel resposta) { if (!ModelState.IsValid) { return(Ok(Resultado.Failed("Dados inválidos"))); } var userId = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value); return(Ok(await _questionarioRespostaService.Create(resposta, userId))); }
public async Task <Resultado> Create(CadastroQuestionarioRespostaViewModel resposta, int idUsuario) { var response = Mapper.Map <QuestionarioResposta>(resposta); response.SetUser(idUsuario); await _service.Create(response); return(Notificador.HasNotification() ? Resultado.Failed(Notificador.GetNotificationsMessages()) : Resultado.Successfull()); }