@Override public BlogTO createBlog(BlogTO blogTO) { CustomerTO customer = customerService.getCustomer(blogTO.getCustomer().getId()); blogTO.setCustomer(customer); BlogDO savedDO = blogRepository.save(blogConverter.convertTOIntoEntity(blogTO, new BlogDO())); return blogConverter.convertEntityIntoTO(savedDO, blogTO); }
@Override public BlogTO updateBlog(BlogTO blogTO) { BlogDO blogDO = blogRepository.findOne(blogTO.getId()); blogConverter.convertTOIntoEntity(blogTO, blogDO); return blogConverter.convertEntityIntoTO(blogRepository.save(blogDO), blogTO); }