示例#1
0
        //Case 8: Delete student
        public void DeleteStudentById()
        {
            var    EnterID    = new EnterInformation();
            var    InterFace  = new InterfaceOfUser();
            string IdToDelete = EnterID.EnterIdToFind();

            if (InterFace.IsIdExist(IdToDelete, Students) == true)
            {
                Console.WriteLine("Student does not exist");
            }
            else
            {
                foreach (Student student in Students)
                {
                    Students.RemoveAll(s => string.Compare(s.Id, IdToDelete, true) == 0);
                    Console.WriteLine("Deleted");
                    break;
                }
            }
        }
示例#2
0
        //case 3: Find student
        public void FindByID()
        {
            var    enterInfor = new EnterInformation();
            var    InterFace  = new InterfaceOfUser();
            string idFind     = enterInfor.EnterIdToFind();

            Console.Clear();
            if (InterFace.IsIdExist(idFind, Students) == true)
            {
                Console.WriteLine("Not Found");
            }
            else
            {
                InterFace.HeaderOfTableOfInformation();
                foreach (Student item in Students)
                {
                    if (item.Id == idFind)
                    {
                        item.ReturnInformationOfAStudent();
                    }
                }
            }
        }