Exemple #1
0
        public async Task <IActionResult> Matricular([FromBody] ClienteDto novoCliente)
        {
            if (!ModelState.IsValid)
            {
                return(CustomResponse(ModelState));
            }

            if (!_contaService.SenhaForte(novoCliente.Senha))
            {
                return(CustomResponse());
            }

            var usuario = _usuarioService.GerarNovoUsuarioCliente(novoCliente.Senha);

            var cliente = ClienteMapper.ClienteDtoParaCliente(novoCliente, usuario);

            await _clienteService.Matricular(cliente, novoCliente.PlanoId);

            return(CustomResponse(new { Id = cliente.Usuario.Id }));
        }