public Models.TbCartaoComentario ToTbCartaoComentario(Models.Request.CartaoComentarioRequest req)
        {
            Models.TbCartaoComentario tb = new Models.TbCartaoComentario();

            tb.DsComentario = req.Comentario;
            tb.IdCartao     = req.IdCartao;
            tb.IdUsuario    = req.IdUsuario;

            return(tb);
        }
        public async Task <ActionResult <Models.Response.CartaoComentarioResponse> > DeletarComentarioAsync(int idLogin, Models.Request.CartaoComentarioRequest req)
        {
            try
            {
                Models.TbCartaoComentario tbComentario = cartaoCnv.ToTbCartaoComentario(req);

                if (tbComentario == null)
                {
                    return(NotFound());
                }

                tbComentario = await cartaoBsn.DeletarComentarioPorIdLoginAsync(idLogin, tbComentario);

                Models.Response.CartaoComentarioResponse resp = cartaoCnv.ToCartaoComentarioResponse(tbComentario);

                return(resp);
            }
            catch (Exception e)
            {
                return(BadRequest(
                           new Models.Response.ErroResponse(404, e.Message)
                           ));
            }
        }
        public async Task <ActionResult <Models.Response.CartaoComentarioResponse> > AlterarComentarioAsync(int idLogin, Models.Request.CartaoComentarioRequest req)
        {
            Models.TbCartaoComentario tbComentarioAtual = await cartaoBsn.ConsutarComentarioPorIdLoginAsync(idLogin);

            if (tbComentarioAtual == null)
            {
                return(NotFound());
            }

            Models.TbCartaoComentario tbComentarioNovo = cartaoCnv.ToTbCartaoComentario(req);

            tbComentarioAtual = await cartaoBsn.AlterarComentarioPorIdLoginAsync(idLogin, tbComentarioAtual, tbComentarioNovo);

            Models.Response.CartaoComentarioResponse resp = cartaoCnv.ToCartaoComentarioResponse(tbComentarioAtual);

            return(resp);
        }
        public async Task <ActionResult <Models.Response.CartaoComentarioResponse> > CadastrarComentarioAsync(Models.Request.CartaoComentarioRequest req)
        {
            try
            {
                Models.TbCartaoComentario tbComentario = cartaoCnv.ToTbCartaoComentario(req);

                tbComentario = await cartaoBsn.AdicionarComentarioCartaoAsync(tbComentario);

                Models.Response.CartaoComentarioResponse resp = cartaoCnv.ToCartaoComentarioResponse(tbComentario);

                return(resp);
            }
            catch (Exception e)
            {
                return(BadRequest(
                           new Models.Response.ErroResponse(400, e.Message)
                           ));
            }
        }