Exemplo n.º 1
0
 /**
  * Wrapper method that saves photo. If photo exists, it updates existing photo. If photo doesn't
  * exist, it makes new photo.
  *
  * @param photo
  * @return true if it is added/updated correctly. false if there is an exception.
  */
 public boolean savePhoto(Photo photo) {
   try {
     if (photo.getId() == 0) {
       return db.addPhoto(photo) != -1;
     } else {
       return db.updatePhoto(photo) > 0;
     }
   } catch (Exception e) {
     return false;
   }
 }
Exemplo n.º 2
0
 /**
  * Wrapper method that deletes photo by photo class
  *
  * @param photo
  * @return true if it is deleted correctly. False if there is an exception
  */
 public boolean deletePhoto(Photo photo) {
   return deletePhoto(photo.getId());
 }