public BECategory ModifierCategory(int idCat, string nom, bool pardef, int idUser) { CategoryDao categoryDao = new CategoryDao(); if (!categoryDao.CateogryExisteDeja(idCat)) { throw new ArgumentException("La categorie n'existe pas", "id"); } BECategory category = null; try { category = categoryDao.ModifierCategory(idCat, nom, pardef, idUser); if (category == null) { throw new Exception("La categorie est null."); } } catch (Exception ex) { throw new Exception("Une erreur est survenue lors de la modification de la catégorie", ex); } return(category); }
public bool SupprimerCategory(int id, int idUser) { CategoryDao categoryDao = new CategoryDao(); if (!categoryDao.CateogryExisteDeja(id)) { throw new ArgumentException("La categorie n'existe pas", "id"); } bool category = false; try { category = categoryDao.SupprimerCategory(id, idUser); if (category == false) { throw new Exception("Erreur lors de la suppression de la category."); } } catch (Exception ex) { throw new Exception("Une erreur est survenue lors de la suppression de la category.", ex); } return(category); }