예제 #1
0
 public override void Add_Item(Instructor item)
 {
     using (ElectiveContext db = new ElectiveContext())
     {
         db.Instructors.Add(item);
         db.SaveChanges();
     }
 }
예제 #2
0
 public override void Delete_Item(int item)
 {
     using (ElectiveContext db = new ElectiveContext())
     {
         db.Students.Remove(db.Students.FirstOrDefault(e => e.Id == item));
         db.SaveChanges();
     }
 }
예제 #3
0
 public override void Add_Item(Subject item)
 {
     using (ElectiveContext db = new ElectiveContext())
     {
         db.Subjects.Add(item);
         db.SaveChanges();
     }
 }
예제 #4
0
 /// <summary>
 /// 更新管理员登录时间
 /// </summary>
 /// <param name="admin">管理员对象</param>
 public void UpdateLoginTime(SysAdmin admin)
 {
     if (admin != null)
     {
         admin.LastLoginTime   = DateTime.Now;
         db.Entry(admin).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
예제 #5
0
 public override void Add_Item(Student item)
 {
     using (ElectiveContext db = new ElectiveContext())
     {
         var id = db.Students.Max(p => p.Id);
         item.Id = ++id;
         db.Students.Add(item);
         db.SaveChanges();
     }
 }