/// <summary> /// Supprime la question correspondant à l'id donné /// </summary> /// <param name="id"></param> /// <returns>"1" si tout c'est bien passé, "0" sinon </returns> internal int DeleteQuestion(int id) { Question question = this.questionsRepository.Find(id); int idAnswer = (int)question.IdAnswer; int reussi = questionsRepository.Delete(id); AnswerServices.Delete(idAnswer); return(reussi); }
public string DeleteQuestion(string id) { var question = _repo.GetById(id); var deleted = _repo.Delete(question.Id); if (!deleted) { throw new Exception("This question too STRONK! Unable to delete the question."); } return(id); }
internal string Delete(int id, string creatorId) { Question data = _repo.GetById(id); if (data == null) { throw new Exception("Invalid Id"); } if (data.CreatorId != creatorId) { throw new Exception("Denied Invalid Permissions"); } if (data.IsSolved == true) { throw new Exception("Question has Been Solved"); } _repo.Delete(id); return("Successfully Deleted!"); }