public void DeleteLibraryQuestion(Int32 questionId) { var existingItem = LibrariesDal.GetLibraryQuestionById(this.AccessTokenId, questionId); if (existingItem == null) { throw new VLException(SR.GetString(SR.There_is_no_item_with_id, "LibraryQuestion", questionId)); } #region SecurityLayer if (this.PrincipalType == Core.PrincipalType.SystemUser) { CheckPermissions(VLPermissions.ManageSystem, VLPermissions.Developer, VLPermissions.SystemService, VLPermissions.ManageBuidingBlocks); } else { throw new VLAccessDeniedException(); } #endregion //Δεν μπορούμε να διαγράψουμε την συγκεκριμένη ερώτηση εάν έχει ήδη χρησιμοποιηθεί: if (SurveysDal.GetQuestionsForLibraryQuestionCount(this.AccessTokenId, existingItem.QuestionId) > 0) { throw new VLException("You cannot delete this LibraryQuestion! It is been used by Survey Questions!"); } LibrariesDal.DeleteLibraryQuestion(this.AccessTokenId, questionId); }