public ActionResult XemCTDeThiDocBienQC(int maDeThi) { GetListCauHoi_DeThiResponse deThi = new GetListCauHoi_DeThiResponse(); Task.Run(async() => { deThi = await _cauHoiAppService.GetListCauHoi_DeThi(maDeThi) as GetListCauHoi_DeThiResponse; }).Wait(); return(View(deThi)); }
public void TestGetListCauHoi_DeThi() { CauHoiAppService _cauHoiAppService = new CauHoiAppService(); GetListCauHoi_DeThiResponse deThi = new GetListCauHoi_DeThiResponse(); Task.Run(async() => { deThi = await _cauHoiAppService.GetListCauHoi_DeThi((int)DSCHUDE.TuVungNguPhap) as GetListCauHoi_DeThiResponse; }).Wait(); TestContext.WriteLine(deThi.deThi.MaDe); }
public async Task <GetListCauHoi_DeThiResponse> GetListCauHoi_DeThi(GetListCauHoi_DeThiRequest r) { GetListCauHoi_DeThiResponse response = new GetListCauHoi_DeThiResponse(); IEnumerable <CauHoi> listCauHoi = await _cauHoiRepository.GetListCauHoi_DeThi(r.IdDeThi); if (listCauHoi.ToList().Count == 0) { response.Message = "Câu hỏi không được tìm thấy"; } else { response.CauHois.AddRange(listCauHoi); } response.deThi = await _deThiRepository.GetDeThiById(r.IdDeThi); return(response); }
public async Task <GetListCauHoi_DeThiResponse> GetListCauHoi_DeThi(int idDeThi) { using (var client = new HttpClient()) { GetListCauHoi_DeThiResponse result = new GetListCauHoi_DeThiResponse(); client.BaseAddress = new Uri(Constants.URI); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); var response = await client.GetAsync(string.Format(Constants.GetListCauHoi_DeThi, idDeThi)); if (response.IsSuccessStatusCode) { result = await response.Content.ReadAsAsync <GetListCauHoi_DeThiResponse>(); } return(result); } }