// GET: Questions/Index
        public async Task <ActionResult> Index()
        {
            var questions = await questionsService.GetAll();

            if (questions == null)
            {
                return(HttpNotFound());
            }
            return(View(questions));
        }
 public ActionResult <IEnumerable <Question> > Get()
 {
     try
     {
         return(Ok(_qs.GetAll()));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Пример #3
0
        // GET: Pizzas/Create
        public async Task <ActionResult> Create()
        {
            var module = (await moduleService.GetAll());

            for (int i = 0; i < module.Count; i++)
            {
                module[i].ModuleId = i + 1;
            }

            var candidats = new SelectList(await candidatService.GetAll(), "Id", "Nom");
            var modules   = new SelectList(await moduleService.GetAll(), "ModuleId", "ModuleLib");
            var questions = new SelectList(await questionService.GetAll(), "QuestionId", "QuestionLib");

            //var questions = new SelectList(await questionService.GetAll(), "Param1", "Param2", "...");

            var vm = new QuizzCreateUpdateVM
            {
                AvailableCandidats = candidats,
                AvailableModules   = modules,
                AvailableQuestions = questions
            };

            return(View(vm));
        }
 public ActionResult <IEnumerable <Question> > Get()
 {
     return(_qs.GetAll().ToList());
 }