public IActionResult CreateExamAJAX(ExamModel examModel) { var access = new SqlDataAccess(); int newRow = 0; if (ModelState.IsValid) { newRow = access.CreateTest(examModel.testTitle, examModel.classID); return(RedirectToAction("ExamCreation", new { examId = newRow })); } return(View()); }