public async Task <IEnumerable <Nghe> > LayDSFileNghe(GetListFileNgheRequest r)
        {
            using (IDbConnection dbConnection = _connection)
            {
                DynamicParameters parameters = new DynamicParameters();
                parameters.Add("@idChuDe", r.idTopic, DbType.Int32);
                var listFileNghe = await dbConnection.QueryAsync <Nghe>(Constants.Nghe_GetListByTopic, param : parameters, commandType : CommandType.StoredProcedure);

                return(listFileNghe);
            }
        }
Example #2
0
        public async Task <IEnumerable <NgheEntity> > GetDSNghe_CauHoi(int maTopic)
        {
            List <NgheEntity>      list = new List <NgheEntity>();
            GetListFileNgheRequest r    = new GetListFileNgheRequest();

            r.idTopic = maTopic;
            var listNghe = await _ngheRepository.LayDSFileNghe(r);

            foreach (var item in listNghe)
            {
                var listCH = await _cauHoiRepository.GetListCauHoi_IDNghe(item.ID) as List <CauHoi>;

                list.Add(new NgheEntity
                {
                    nghe    = item,
                    CauHois = listCH
                });
            }
            return(list);
        }