ExamWeb/Controllers/HomeController.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ExamWeb.Models;
namespace ExamWeb.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
//退出登录
string url = Request.RawUrl;
if (url.Contains("?exit"))
{
Session.Clear();
return RedirectToAction("Index", "Home");
}
return View();
}
public ActionResult About()
{
return View();
}
//教师登录
[HttpPost]
public ActionResult LoginTeacher(Teacher teacher, string Login_Code)
{
//模型验证
if (!ModelState.IsValid)
{
return View();
}
//验证用户验证码
string code = Session["sn"].ToString().ToLower();
if (Login_Code.ToLower() == code)
{
using (ExamDBEntities db = new ExamDBEntities())
{
var result = db.Teacher.Where(t => t.TeacherLoginName == teacher.TeacherLoginName && t.TeacherLoginPwd == teacher.TeacherLoginPwd).ToList();
if (result.Count == 1)
{
Session.Clear();
Session["Teacher"] = result[0].TeacherName;//保持教师登录状态
return RedirectToAction("Index");
}
}
}
return View();
}
public ActionResult LoginTeacher()
{
return View();
}
后面还有 33 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。