示例#1
0
  public static Result deleteThirdParty(long thirdPartyId) {
    AppUtils.setHeaders(response());

    ThirdParty thirdParty = ThirdParty.getById(thirdPartyId);
    thirdParty.delete();

    return Results.ok(AppUtils.okJsonResponse());
  }
示例#2
0
  public static Result addThirdParty() {
    AppUtils.setHeaders(response());

    try {
      ThirdParty thirdParty = Form.form(ThirdParty.class).bindFromRequest().get();
      thirdParty.save();

      return Results.ok(Json.toJson(thirdParty));
    } catch (Exception e) {
      e.printStackTrace();
      return Results.internalServerError(AppUtils.errorJsonResponse(e.getMessage()));
    }
  }
示例#3
0
  public static Result getThirdParty(long thirdPartyId) {
    AppUtils.setHeaders(response());

    ThirdParty thirdParty = ThirdParty.getById(thirdPartyId);
    return Results.ok(Json.toJson(thirdParty));
  }
示例#4
0
  public static Result getThirdParties() {
    AppUtils.setHeaders(response());

    List<ThirdParty> thirdParties = ThirdParty.getAll();
    return Results.ok(Json.toJson(thirdParties));
  }