예제 #1
0
        public IEnumerable <Stage> GetStagesByQuiz(int quizId)
        {
            var sql = $"Select * From Stages Where Stages.QuizId = @id";

            IEnumerable <Stage> result = _connectionString.Query <Stage>(sql, new { id = quizId });

            if (result == null)
            {
                _logger.LogError($"Stages not find with this quiz id: {quizId}");
                return(result);
            }

            using (var fileObjRepo = new FileObjectRepository(_transaction, _logger))
            {
                foreach (var item in result)
                {
                    item.Files = fileObjRepo.GetAllFilesForObject(item);
                }
            }

            return(result);
        }
예제 #2
0
        public IEnumerable <Ending> GetEndingsByStage(int stageId)
        {
            var sql = $"Select * From Endings Where Endings.StageId = @id";

            IEnumerable <Ending> result = _connectionString.Query <Ending>(sql, new { id = stageId });

            if (result == null)
            {
                _logger.LogError($"Endings not find with this stage id: {stageId}");
                return(result);
            }

            using (var fileObjRepo = new FileObjectRepository(_transaction, _logger))
            {
                foreach (var item in result)
                {
                    item.Files = fileObjRepo.GetAllFilesForObject(item);
                }
            }

            return(result);
        }