Beispiel #1
0
        // Student Notification
        #endregion
        #region
        // OnConnected Override !

        public void ListConnectedEmployee(int Type_Id, EmployeeConnectionId IcId)
        {
            if (Type_Id == 0)
            {
                bool Persisted = db.EmployeeConnectionIds.Where(x => x.Emp_Id == IcId.Emp_Id).Any();
                if (Persisted != true)
                {
                    db.EmployeeConnectionIds.Add(IcId);
                    db.SaveChanges();
                }
            }
            else if (Type_Id == 1)
            {
                var ins = new InstructorsConnectionId()
                {
                    Ins_Id         = IcId.Emp_Id,
                    Connection_Ids = IcId.Connection_Ids
                };
                bool Persisted = db.InstructorsConnectionIds.Where(x => x.Ins_Id == ins.Ins_Id).Any();
                if (Persisted != true)
                {
                    db.InstructorsConnectionIds.Add(ins);
                    db.SaveChanges();
                }
            }
        }
Beispiel #2
0
 // OnDisconnected Override !
 public void UnListConnectedEmployee(int Type_Id, EmployeeConnectionId IcId)
 {
     if (Type_Id == 0)
     {
         db.EmployeeConnectionIds.Remove(IcId);
         db.SaveChanges();
     }
     else if (Type_Id == 1)
     {
         InstructorsConnectionId obj = db.InstructorsConnectionIds.Where(E => E.Ins_Id == IcId.Emp_Id).SingleOrDefault();
         db.InstructorsConnectionIds.Remove(obj);
         db.SaveChanges();
     }
 }