//public List<QuestionResponseTableTypeModel> GetTableTypeResponse(Guid questionId, Guid plantId, int selectedYear) //{ // try // { // List<QuestionResponseTableTypeModel> responseList = new List<QuestionResponseTableTypeModel>(); // List<CDPTabularQuestionAnswer> dbResponseList = _context.CDPTabularQuestionAnswers.Where(m => m.PlantId == plantId && m.QuestionId == questionId && m.Year == selectedYear).ToList(); // responseList = (from list in dbResponseList // select new QuestionResponseTableTypeModel // { // GridIndexId = list.Id, // QuestionId = list.QuestionId, // GridCol1 = list.GridColumn1, // GridCol2 = list.GridColumn2, // GridCol3 = list.GridColumn3, // GridCol4 = list.GridColumn4, // GridCol5 = list.GridColumn5, // }).ToList(); // return responseList; // } // catch (Exception ex) // { // throw ex; // } //} public JsondataQuestions GetQuestionIdForJson(Guid questionId) { JsondataQuestions oJsondataQuestions = new JsondataQuestions(); var response = _context.CDPQuestions.Select(p => p).Where(p => p.QId == questionId).FirstOrDefault(); oJsondataQuestions.QId = response.QId; oJsondataQuestions.QuestionId = response.QuestionId; return(oJsondataQuestions); }
public JsonResult CreateTubalarStructure(Guid questionId) { JsondataQuestions oJsondataQuestions = new JsondataQuestions(); oJsondataQuestions = oQuestionnaireService.GetQuestionIdForJson(questionId); string JsonFileLocation = ConfigurationManager.AppSettings["JsonLocation"].ToString(); string path = Server.MapPath(JsonFileLocation); string jsonFileName = oJsondataQuestions.QuestionId.Replace('.', '_'); path += jsonFileName + ".json"; string JsonString = System.IO.File.ReadAllText(path); return(Json(new { data = JsonString }, JsonRequestBehavior.AllowGet)); }