public ViewCustomModel EditViewQuestion(int id)
        {
            var data = db.Questions.FirstOrDefault(e => e.Id == id);

            if (data != null)
            {
                var obj = new ViewCustomModel
                {
                    _id           = data.Id,
                    questionText  = data.QuestionText,
                    option1       = data.Option1,
                    option2       = data.Option2,
                    option3       = data.Option3,
                    option4       = data.Option3,
                    weightage     = data.Weightage,
                    answer        = data.Answer,
                    answerType    = data.AnswerType,
                    questionImage = data.QuestionImage
                };
                return(obj);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        public IActionResult EditviewQuestions(int id)
        {
            QuestionOperation question = new QuestionOperation();
            ViewCustomModel   data     = question.EditViewQuestion(id);

            if (data != null)
            {
                return(Ok(data));
            }
            return(BadRequest(new { msg = "data not found", status = 404 }));
        }