public HttpResponseMessage Get(int Id) { int pdfcategory = Convert.ToInt32(Id); var currentDateTime = _localDateTimeService.GetDateTime(); //var projection = _testPaperService.GetPaperById(testPaperId); var projection = _pdfcategoryservice.GetPDFCategoryById(Id); // var listOfQuestionIds = JsonConvert.DeserializeObject<List<TestPaperQuestionsDetails>>(projection.DelimitedQuestionIds); var listOfpdfIds = JsonConvert.DeserializeObject <List <PdfcategoryDetails> >(projection.PDFCategoryId.ToString()); // var questionIds = listOfQuestionIds.Select(x => x.questionId).ToList(); var pdfIds = listOfpdfIds.Select(x => x.PDFCategoryId).ToList(); //var questionDetails = _questionService.GetQuestionsDetailsForStudentAppOnlineTest(questionIds); var pdfDEtails = _pdfcategoryservice.GetPDFCategoryById(pdfIds); /*foreach (var question in pdfDEtails) * { * if (question.Answer == "1") * question.Answer = "A"; * else if (question.Answer == "2") * question.Answer = "B"; * else if (question.Answer == "3") * question.Answer = "C"; * else if (question.Answer == "4") * question.Answer = "D"; * }*/ var result = new { CurrentDateTime = currentDateTime, PdfcategoryDetails = pdfDEtails }; return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public ActionResult Edit(int id) { var projection = _pdfCategoryService.GetPDFCategoryById(id); if (projection == null) { _logger.Warn(string.Format("PDF Category does not Exists {0}.", id)); Warning("PDF Category does not Exists."); return(RedirectToAction("Index")); } var viewModel = AutoMapper.Mapper.Map <PDFCategoryProjection, PDFCategoryViewModel>(projection); return(View(viewModel)); }