public ResultBM Delete(object entity) { try { DonationDAL donationDal = new DonationDAL(); DonationBM donationBm = entity as DonationBM; if (donationBm.IsReceived()) { if (!donationDal.IsInUse(donationBm.id)) { donationDal.DeleteDonation(donationBm.id); return(new ResultBM(ResultBM.Type.OK, "Se ha eliminado el registro.", donationBm)); } else { return(new ResultBM(ResultBM.Type.FAIL, SessionHelper.GetTranslation("DONATION_ASSIG_UNDELETEABLE_ERROR"), donationBm)); } } else { return(new ResultBM(ResultBM.Type.FAIL, SessionHelper.GetTranslation("DONATION_STATUS_UNDELETEABLE_ERROR"), donationBm)); } } catch (Exception exception) { return(new ResultBM(ResultBM.Type.EXCEPTION, SessionHelper.GetTranslation("DELETING_ERROR") + " " + exception.Message, exception)); } }