Exemplo n.º 1
0
        public IActionResult EditTestDetails(int id)
        {
            var result = examsession.Edit(id);

            if (result.status)
            {
                System.Collections.Generic.List <QuestionAnswerListModel> lst = new System.Collections.Generic.List <QuestionAnswerListModel>();
                foreach (var item in result.Data.listQuestionAnswer)
                {
                    QuestionAnswerListModel obj = new QuestionAnswerListModel();
                    obj.AnswerId   = item.AnswerId;
                    obj.Answer     = item.Answer;
                    obj.QuestionId = item.QuestionId;
                    obj.Question   = item.Question.Question;
                    // obj.Question = item.ExamQuestion.Question;
                    obj.TestId = item.ExamDetailId;
                    lst.Add(obj);
                }
                return(Ok(new { ID = result.Data.Id, FirstName = result.Data.FirstName, LastName = result.Data.LastName, Notes = result.Data.Notes, Source = result.Data.Source, ExamStatus = result.Data.ExamStatus, TestId = result.Data.TestId, QuestionsAnswerList = lst }));
            }
            else
            {
                return(BadRequest(result.message));
            }
        }
Exemplo n.º 2
0
        public ActionResult Edit(int id)
        {
            var result = examsession.Edit(id);

            if (result.status)
            {
                ViewBag.ExamStatuses = statusList;
                ViewBag.Sources      = sourceList;
                ViewBag.Exams        = testList;
                return(PartialView("_EditSession", result.Data));
            }
            else
            {
                ViewBag.ErrorMessage = result.message;
                return(View("Error"));
            }
        }