Exemplo n.º 1
0
        public UsersController(IUsersManager usersManager,
                               ICacheManager cacheManager,

                               IAnswersManager answersManager,
                               IQuestionsManager questionsManager,
                               INurseSelfAssessmentAnswersManager nurseSelfAssessmentAnswersManager
                               )
        {
            _usersManager     = usersManager;
            _cacheManager     = cacheManager;
            _answersManager   = answersManager;
            _questionsManager = questionsManager;
            _nurseSelfAssessmentAnswersManager = nurseSelfAssessmentAnswersManager;



            //Get Answers
            var answers_result = _answersManager.Get();
            var answers_List   = (List <AnswerEntity>)answers_result.Entity;

            answerDictionary = answers_List.ToDictionary(x => new Tuple <int, decimal>(x.QuestionId, x.Value), x => x);

            //Get Questions
            var questions_result = _questionsManager.Get();
            var questions_List   = (List <QuestionEntity>)questions_result.Entity;

            questionDictionary = questions_List.ToDictionary(x => x.QuestionId, x => x);
        }
Exemplo n.º 2
0
        public ActionResult Edit(int id, string type, string quizType)
        {
            ViewBag.Sectors = (IEnumerable <SectorEntity>)_sectorsManager.Get().Entity;
            var entity = _questionsManager.Get(id).Entity as QuestionEntity;
            var model  = _mapper.Map <QuestionEntity, QuestionViewModel>(entity);

            model.Operation = "E";
            model.QuizType  = quizType;
            model.Type      = type;
            switch (quizType)
            {
            case "PATHWAY":
                ViewBag.Sectors   = (IEnumerable <SectorEntity>)_sectorsManager.Get().Entity;
                ViewBag.TitleQuiz = "Career Pathways";
                return(View("InsertEdit", model));

            case "ABOUT":
                ViewBag.TitleQuiz = "About you";
                return(View("InsertEdit", model));
            }
            TempData["ErrorMessage"] = "An error occurred";
            return(RedirectToAction("Index", "Home"));
        }