public IActionResult LoginSubmit() { string xuehao = Request.Form["username"].ToString(); string password = Request.Form["password"].ToString(); if (string.IsNullOrEmpty(xuehao) || string.IsNullOrEmpty(password) || string.IsNullOrWhiteSpace(xuehao) || string.IsNullOrWhiteSpace(password)) { return(Redirect("../Login/LoginResult")); } TblStudentDto dto = new TblStudentDto { StudentNum = xuehao, StudentPassword = password }; StudentDa da = new StudentDa { XuanKeDB = XuanKeDB }; var flag = da.StudentLogin(dto); if (flag) { HttpContext.Session.SetString(SessionCode.username, xuehao); return(Redirect("../Home/StudentResult")); } return(Redirect("../Login/LoginResult")); }
public IActionResult StudentResult() { ViewBag.Title = "学生选课系统-学生端-学生信息"; var query = new TblStudentQuery(); var stucode = HttpContext.Session.GetString(SessionCode.username); if (string.IsNullOrEmpty(stucode)) { return(Redirect("../Login/LoginResult")); } var da = new StudentDa { XuanKeDB = DBContext }; query.StudentNum = stucode; var student = da.GetStudentDetail(query); ViewBag.student = student; return(View()); }
public IActionResult StudentResult() { ViewBag.Title = "学生选课系统-后台管理-学生管理"; var admincode = HttpContext.Session.GetString(SessionCode.adminname); if (string.IsNullOrEmpty(admincode)) { return(Redirect("../Login/LoginAdminResult")); } StudentDa da = new StudentDa { XuanKeDB = DBContext }; var query = new TblStudentQuery { PageIndex = 1, Page = 20 }; List <TblStudent> students = da.GetStudentsList(query); ViewBag.students = students; return(View()); }