/** * A controller method for assigning an item to a guest. * * @param id Id of the item to delete. * @return {@code BaseResponse} Stating the result of the process. */ @RequestMapping(value = "/item", method = RequestMethod.DELETE) public BaseResponse deleteItem(@RequestParam("id") long id) { mLogger.info("Deleting item with id #{}", id); try { Item item = mEventService.deleteItem(id); return new BaseResponse<>(item.createRepresentationalObject()); } catch (ServiceException e) { mLogger.error(e.getMessage()); return new BaseResponse<>(e.getMessage(), BaseResponse.INTERNAL_ERROR); } }
/** * A controller method for updating an item with the given id. * * @param id Id of the item to delete. * @param isBringing Whether the guest is bringing the item. * @return {@code BaseResponse} Stating the result of the process. */ @RequestMapping(value = "/item", method = RequestMethod.PUT) public BaseResponse updateItem( @RequestParam("id") long id, @RequestParam("bringing") boolean isBringing) { mLogger.info("Updating item with id #{}", id); try { Item item = mEventService.updateItem(id, isBringing); return new BaseResponse<>(item.createRepresentationalObject()); } catch (ServiceException e) { mLogger.error(e.getMessage()); return new BaseResponse<>(e.getMessage(), BaseResponse.INTERNAL_ERROR); } }