Controllers/DepartmentController.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using WebApplication1.Models;
using WebApplication1.Models.Entities;
namespace WebApplication1.Controllers
{
public class DepartmentController : Controller
{
private MyDataContext db = new MyDataContext();
// GET: Department
public ActionResult Index()
{
if (Session["UserId"] == null)
{
return Redirect("~/User/Login");
}
else
{
String name = Session["UserName"].ToString();
ViewBag.notice = name;
return View(db.DepartmentDataContext.ToList());
}
}
// GET: Department/Details/5
public ActionResult Details(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Department department = db.DepartmentDataContext.Find(id);
if (department == null)
{
return HttpNotFound();
}
return View(department);
}
// GET: Department/Create
public ActionResult Create()
{
return View();
}
// POST: Department/Create
// 为了防止“过多发布”攻击,请启用要绑定到的特定属性;有关
// 更多详细信息,请参阅 https://go.microsoft.com/fwlink/?LinkId=317598。
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "DepartmentId,DepartmentName")] Department department)
后面还有 93 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
