@PUT @Path("/updateBusinessType/{businessTypeId}") @ApiOperation(value = "Update business type") @UnitOfWork public Response updateBusinessType( @PathParam("businessTypeId") final Long businessTypeId, final BusinessTypeModel model) { final User user = new User(); user.setId(model.getUserId()); final Company company = new Company(); company.setId(model.getCompanyId()); final BusinessType businessType = new BusinessType(); businessType.setId(businessTypeId); dao.load(businessType); businessType.setUpdatedDate(new Date()); businessType.setUpdatedBy(user); businessType.setName(model.getName()); businessType.setStatus(model.getStatus()); dao.update(businessType); return Response.status(200).entity(businessType.getId()).build(); }
@POST @Path("/saveBusinessType") @ApiOperation(value = "Add new business type") @UnitOfWork public Response saveBusinessType(final BusinessTypeModel model) { final User user = new User(); user.setId(model.getUserId()); final Company company = new Company(); company.setId(model.getCompanyId()); final BusinessType businessType = new BusinessType(); businessType.setCreatedDate(new Date()); businessType.setCreatedBy(user); businessType.setName(model.getName()); businessType.setStatus(model.getStatus()); dao.create(businessType); return Response.status(200).entity(businessType.getId()).build(); }