예제 #1
0
        public IHttpActionResult Post([FromBody] CartaoDTO cartao)
        {
            try
            {
                cartao.UsuarioId = Convert.ToInt32(OwinContextProvider.GetClaimValue("userId"));
                cartao           = _business.Insert(cartao);
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }

            return(Ok(cartao));
        }
예제 #2
0
        public IHttpActionResult Put([FromBody] EnderecoDTO endereco)
        {
            try
            {
                endereco.UsuarioId = Convert.ToInt32(OwinContextProvider.GetClaimValue("userId"));
                _business.Update(endereco);
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }

            return(Ok());
        }
예제 #3
0
        public IHttpActionResult GetAllFromUser()
        {
            List <CartaoDTO> cartoes = new List <CartaoDTO>();

            try
            {
                int userId = Convert.ToInt32(OwinContextProvider.GetClaimValue("userId"));
                cartoes = _business.GetAllFromUser(userId);
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }

            return(Ok(cartoes));
        }
예제 #4
0
        // GET: api/Produtos
        public IHttpActionResult GetAllFromUser(int page)
        {
            List <PedidoDTO> pedidos = new List <PedidoDTO>();

            try
            {
                int userId = Convert.ToInt32(OwinContextProvider.GetClaimValue("userId"));
                pedidos = _business.GetAllFromUser(userId, page);
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }

            return(Ok(pedidos));
        }