Beispiel #1
0
 public void DeleteSubject(int id)
 {
     using (db_schedule db = new db_schedule())
     {
         Subject subject = db.Subject
                           .Where(o => o.ID_Subject == id)
                           .FirstOrDefault();
         db.Subject.Remove(subject);
         db.SaveChanges();
     }
 }
Beispiel #2
0
 public void DeleteGroup(int id)
 {
     using (db_schedule db = new db_schedule())
     {
         Group group = db.Group
                       .Where(o => o.ID_Group == id)
                       .FirstOrDefault();
         db.Group.Remove(group);
         db.SaveChanges();
     }
 }
Beispiel #3
0
        public void UpdateRoom(Room room)
        {
            using (db_schedule db = new db_schedule())
            {
                Room s = db.Room
                         .Where(o => o.ID_Room == room.ID_Room)
                         .FirstOrDefault();
                s.Number = room.Number;

                db.SaveChanges();
            }
        }
Beispiel #4
0
        public void UpdateSubject(Subject subject)
        {
            using (db_schedule db = new db_schedule())
            {
                Subject s = db.Subject
                            .Where(o => o.ID_Subject == subject.ID_Subject)
                            .FirstOrDefault();
                s.Name = subject.Name;

                db.SaveChanges();
            }
        }
Beispiel #5
0
        public void UpdateGroup(Group group)
        {
            using (db_schedule db = new db_schedule())
            {
                Group s = db.Group
                          .Where(o => o.ID_Group == group.ID_Group)
                          .FirstOrDefault();
                s.Name = group.Name;

                db.SaveChanges();
            }
        }
Beispiel #6
0
 public Room AddRoom(Room room)
 {
     using (db_schedule db = new db_schedule())
     {
         var count = db.Room
                     .Where(s => s.Number == room.Number)
                     .Count();
         if (count == 0)
         {
             db.Room.Add(room);
             db.SaveChanges();
         }
     }
     return(room);
 }
Beispiel #7
0
 public Subject AddSubject(Subject subject)
 {
     using (db_schedule db = new db_schedule())
     {
         var count = db.Subject
                     .Where(s => s.Name == subject.Name)
                     .Count();
         if (count == 0)
         {
             db.Subject.Add(subject);
             db.SaveChanges();
         }
     }
     return(subject);
 }
Beispiel #8
0
 public Group AddGroup(Group group)
 {
     using (db_schedule db = new db_schedule())
     {
         var count = db.Group
                     .Where(s => s.Name == group.Name)
                     .Count();
         if (count == 0)
         {
             db.Group.Add(group);
             db.SaveChanges();
         }
     }
     return(group);
 }
Beispiel #9
0
 public Couple AddCouple(Couple couple)
 {
     if (couple.Start != null && couple.End != null)
     {
         using (db_schedule db = new db_schedule())
         {
             db.Couple.Add(couple);
             db.SaveChanges();
             return(couple);
         }
     }
     else
     {
         return(couple);
     }
 }
Beispiel #10
0
        public void UpdateUser(User user)
        {
            using (db_schedule db = new db_schedule())
            {
                User u = db.User
                         .Where(s => s.ID_User == user.ID_User)
                         .FirstOrDefault();
                u.Name       = user.Name;
                u.Surname    = user.Surname;
                u.Patronymic = user.Patronymic;
                u.Login      = user.Login;
                u.Password   = user.Password;
                u.Role       = user.Role;

                db.SaveChanges();
            }
        }