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)); }
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()); }
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)); }
// 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)); }