Ejemplo n.º 1
0
        public void SubmitTestResult(UsersToProf usersToProf)
        {
            var add = new UsersToProf
            {
                UserId = usersToProf.UserId,
                ProfId = usersToProf.ProfId
            };

            var checkData = _dbContext.UsersToProfs.Any(_ => _.ProfId == add.ProfId && _.UserId == add.UserId);

            if (checkData)
            {
                return;
            }
            _dbContext.UsersToProfs.Add(add);
            _dbContext.SaveChanges();
        }
Ejemplo n.º 2
0
        public JsonResult TestResult(UsersToProf usersToProf)
        {
            var user = User.Identity.GetUserId();

            if (!ModelState.IsValid)
            {
                return(Json(new { Respone = "Failure" }));
            }

            var submitTest = new UsersToProf()
            {
                ProfId = usersToProf.ProfId,
                UserId = user
            };

            _testRepository.SubmitTestResult(submitTest);
            return(Json(new
            {
                redirectUrl = Url.Action("Index", "Result"),
                isRedirect = true
            }));
        }