public ActionResult Create([Bind(Include = "Id,ClassId,CourseId,TeacherId")] CourseManagements courseManagements) { if (ModelState.IsValid) { db.CourseManagements.Add(courseManagements); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(courseManagements)); }
public void Seed() { var initialActionLinks = new List <ActionLinks> { new ActionLinks { Id = 1, Name = "主页", Controller = "Home", Action = "Index" } }; foreach (var action in initialActionLinks) { if (_context.ActionLinks.Any(r => r.Name == action.Name)) { continue; } _context.ActionLinks.Add(action); } _context.SaveChanges(); }
public void Seed() { var intialSideBars = new List <SideBars> { new SideBars { Name = "班级管理", Controller = "Class", Action = "Index" }, new SideBars { Name = "教师管理", Controller = "Teacher", Action = "Index" }, new SideBars { Name = "学生管理", Controller = "Student", Action = "Index" }, new SideBars { Name = "课程科目管理", Controller = "Course", Action = "Index" }, new SideBars { Name = "课程管理", Controller = "CourseManagement", Action = "Index" }, new SideBars { Name = "左侧导航栏管理", Controller = "SideBar", Action = "Index" }, new SideBars { Name = "顶部导航栏管理", Controller = "ActionLink", Action = "Index" }, }; foreach (var bar in intialSideBars) { if (_context.SideBars.Any(r => r.Name == bar.Name)) { continue; } _context.SideBars.Add(bar); } _context.SaveChanges(); }
public void Seed() { var initialSideBars = new List <SideBars> { new SideBars { Name = "班级管理", Controller = "Class", Ation = "Index" }, new SideBars { Name = "老师管理", Controller = "Teacher", Ation = "Index" }, new SideBars { Name = "学生管理", Controller = "xuesheng", Ation = "Index" }, new SideBars { Name = "课程科目管理", Controller = "kecheng", Ation = "Index" }, new SideBars { Name = "课程安排", Controller = "CourseBiao", Ation = "Index" }, new SideBars { Name = "顶部导航栏管理", Controller = "ActionLink", Ation = "Index" }, new SideBars { Name = "侧边栏管理", Controller = "SideBar", Ation = "Index" }, }; foreach (var bar in initialSideBars) { if (_context.SideBars.Any(r => r.Name == bar.Name)) { continue; } _context.SideBars.Add(bar); } _context.SaveChanges(); }
public void Seed() { var initialUsers = new List <Users> { new Users { Account = "admin", Name = "admin", Password = "******".MD5Encoding() } }; foreach (var action in initialUsers) { if (_context.Users.Any(r => r.Name == action.Name)) { continue; } _context.Users.Add(action); } _context.SaveChanges(); }
public void Seed() { var initialUsers = new List <Users> { new Users { Account = "admin", Name = "admin", Password = "******" } }; foreach (var action in initialUsers) { if (_context.Users.Any(r => r.Name == action.Name)) { continue; } _context.Users.Add(action); } _context.SaveChanges(); }
public void Seed() { var iniitialUsers = new List <Users> { new Users { Name = "admin", Account = "admin", Password = "******" } }; foreach (var user in iniitialUsers) { if (_context.Users.Any(r => r.Name == user.Name)) { continue; } _context.Users.Add(user); } _context.SaveChanges(); }
public void Seed() { var iniitialActionLinks = new List <ActionLinks> { new ActionLinks { Name = "主页", Controller = "Home", Action = "Index", order = 1 }, new ActionLinks { Name = "关于", Controller = "Home", Action = "About", order = 2 }, new ActionLinks { Name = "联系方式", Controller = "Home", Action = "Contact", order = 3 } }; foreach (var action in iniitialActionLinks) { if (_context.ActionLinks.Any(r => r.Name == action.Name)) { continue; } _context.ActionLinks.Add(action); } _context.SaveChanges(); }
public void Seed() { var iniitialSideBars = new List <SideBars> { new SideBars { Name = "班级管理", Controller = "Class", Action = "Index", order = 1 }, new SideBars { Name = "老师管理", Controller = "Teacher", Action = "Index", order = 2 }, new SideBars { Name = "学生管理", Controller = "Student", Action = "Index", order = 3 }, new SideBars { Name = "课程科目管理", Controller = "Course", Action = "Index", order = 4 }, new SideBars { Name = "课程安排", Controller = "CourseManagement", Action = "Index", order = 5 }, new SideBars { Name = "左侧导航栏管理", Controller = "SideBar", Action = "Index", order = 6 }, new SideBars { Name = "顶部导航栏管理", Controller = "ActionLink", Action = "Index", order = 7 } }; foreach (var sidebar in iniitialSideBars) { if (_context.SideBars.Any(r => r.Name == sidebar.Name)) { continue; } _context.SideBars.Add(sidebar); } _context.SaveChanges(); }