@POST @Produces(MediaType.APPLICATION_JSON) public Response inserir(String document) { RestauranteJson json = RestauranteConverter.stringToJson(document); Restaurante model = RestauranteConverter.jsonToModel(json); model = remote.inserir(model); json = RestauranteConverter.modelToJson(model); return Response.status(200).entity(json).build(); }
@GET @Produces(MediaType.APPLICATION_JSON) public Response listar() { List<Restaurante> models = remote.listar(); List<RestauranteJson> jsons = RestauranteConverter.modelToJson(models); return Response.status(200).entity(jsons).build(); }