Exemplo n.º 1
0
  /**
   * Sửa model
   *
   * @param form
   * @return
   * @throws Exception
   */
  @RequestMapping(value = "/edit", method = RequestMethod.POST)
  @ResponseBody
  public Response edit(@RequestBody ModelForm form) throws Exception {
    String id = "test";
    if (viewer != null && viewer.getAdministrator() != null) {
      id = viewer.getAdministrator().getId();
    }
    Model model = new Model();
    model.setCategoryId(form.getCategoryId());
    model.setId(form.getId());
    model.setManufacturerId(form.getManufacturerId());
    model.setEbayKeyword(form.getEbayKeyword());
    model.setName(form.getName());
    if (form.getActive() > 0) {
      model.setActive(form.getActive() == ModelForm.TRUE);
    }

    return modelService.edit(model, id);
  }