public Question(Guid courseId, Guid createdBy, string actualQuestion, LevelOfInterest levelOfInterest, Type type, decimal timeInMinutes = 0) { Id = Guid.NewGuid(); CourseId = courseId; CreatedBy = createdBy; ActualQuestion = actualQuestion ?? throw new ArgumentNullException(nameof(actualQuestion)); LevelOfInterest = levelOfInterest; Type = type; DeadLine = ComputeDeadLine(timeInMinutes); Answers = new HashSet <Answer>(); }
public ActionResult <IReadOnlyList <QuestionDto> > GetByLevelOfInterest(LevelOfInterest levelOfInterest) { IReadOnlyList <Question> questions = _readQuestionRepository.GetByLevelOfInterest(levelOfInterest); if (questions == null) { return(NotFound()); } return(Ok(_mapper.EntityCollectionToDtoCollection(questions))); }
public IReadOnlyList <Question> GetByLevelOfInterest(LevelOfInterest levelOfInterest) { return(_context.Questions.Where(q => q.LevelOfInterest == levelOfInterest).ToList()); }