Example #1
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);
        }
        public IEnumerable <Rule> GetRulesByQuiz(int quizId)
        {
            var sql = $"Select * From Rules Where Rules.QuizId = @id";

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

            if (result == null)
            {
                _logger.LogError($"Rules 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);
        }