Пример #1
0
 @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);
 }
Пример #2
0
 @Override
 public BlogTO updateBlog(BlogTO blogTO) {
   BlogDO blogDO = blogRepository.findOne(blogTO.getId());
   blogConverter.convertTOIntoEntity(blogTO, blogDO);
   return blogConverter.convertEntityIntoTO(blogRepository.save(blogDO), blogTO);
 }