예제 #1
0
        public IActionResult Put([FromBody] UserDadosVO book)
        {
            if (book == null)
            {
                return(BadRequest());
            }
            var updatedBook = _objBusiness.Update(book);

            if (updatedBook == null)
            {
                return(BadRequest());
            }
            return(new OkObjectResult(updatedBook));
        }
예제 #2
0
        public IActionResult Post([FromBody] PedidosVO obj)
        {
            if (obj == null)
            {
                return(BadRequest());
            }
            PontosVO pontos = new PontosVO
            {
                Valor     = obj.Valor,
                Descricao = obj.Descricao,
                Data      = obj.Data,
                UserId    = obj.UserId
            };

            _PontosBusiness.Create(pontos);
            var user = _UserDadosBusiness.FindById(obj.UserId);

            user.Pontos = user.Pontos + obj.Valor;
            _UserDadosBusiness.Update(user);

            return(new OkObjectResult(_objBusiness.Create(obj)));
        }