예제 #1
0
        public IActionResult Index(QuestionViewModel qa)
        {
            var user = User.Claims.ElementAt(0).Value;
            var id   = 0;

            foreach (var item in qa.UtilisateurReponses)
            {
                id = item.IdQuestionnaire;
                item.AspNetUsersId = user;
                _context.UtilisateurReponse.Add(item);
            }

            _context.SaveChanges();


            return(RedirectToAction("ResultTest", new { id = id }));
        }
예제 #2
0
        public IActionResult Index(QuestionViewModel qa)
        {
            var user = User.Claims.ElementAt(0).Value;

            using (var ctx = new questiondbContext())
            {
                foreach (var item in qa.UtilisateurReponses)
                {
                    item.AspNetUsersId = user;
                    ctx.UtilisateurReponse.Add(item);
                }

                ctx.SaveChanges();
            }

            return(View());
        }