@RequestMapping( value = "/api/logs", method = RequestMethod.POST, headers = "Accept=application/json") public @ResponseBody ActivityLog create(@RequestBody ActivityLogDTO activityLogDTO) { logger.debug("Creating a new activityLog with information: " + activityLogDTO); ActivityLog activityLog = new ActivityLog(); activityLog.setName(activityLogDTO.getName()); activityLog.setDescription(activityLogDTO.getDescription()); return activityLogRepository.save(activityLog); }
@RequestMapping( value = "/api/logs/{id}", method = RequestMethod.PUT, headers = "Accept=application/json") public @ResponseBody ActivityLog update( @PathVariable("id") Long id, @RequestBody ActivityLogDTO updated) { logger.debug("Updating activityLog with information: " + updated); ActivityLog activityLog = activityLogRepository.findOne(updated.getId()); activityLog.setName(updated.getName()); activityLog.setDescription(updated.getDescription()); return activityLog; }