コード例 #1
0
        public IActionResult AddExamModelMultiple(long id, [FromForm] ExamModel examModel)
        {
            string user;
            string Uid;


            Request.Cookies.TryGetValue("User", out user);
            Request.Cookies.TryGetValue("Uid", out Uid);
            var u = _UserService.InspectGuid(new TGuid {
                User = user, Uid = Uid,
            });

            if (!ModelState.IsValid || u == null)
            {
                ModelState.AddModelError(string.Empty, "类型添加错误");
                return(View(examModel));
            }
            var str = Request.Form["AA"] + Request.Form["AB"] + Request.Form["AC"] + Request.Form["AD"];

            examModel.Answer   = str;
            examModel.User     = u.UserName;
            examModel.QClassId = id;
            examModel.Multiple = true;

            _ExamService.AddExamModel(examModel);

            return(RedirectToAction(nameof(Index)));
        }