using System; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Collections.Generic; // using List /// /// Summary description for StudentData /// public class StudentData { private static List _studentsList = new List(); private static int id = 0; private int _searchId = 0; public StudentData() { // // TODO: Add constructor logic here // // Non Required } public List SelectStudents() { return _studentsList; } public void ClearStudents() { _studentsList.Clear(); } public void InsertStudent(string name, int age, string course) { _studentsList.Add(new Student(id++, name, age, course)); } private bool FindStudent(Student theStudent) { if (theStudent.Key == _searchId) { return true; } else { return false; } } public void UpdateStudent(int key, string name, int age, string course) { Student foundStudent; _searchId = key; foundStudent = _studentsList.Find(FindStudent); if (foundStudent != null) { foundStudent.Name = name; foundStudent.Age = age; foundStudent.Course = course; } } public void DeleteStudent(int key) { Student foundStudent; _searchId = key; foundStudent = _studentsList.Find(FindStudent); if (foundStudent != null) { _studentsList.Remove(foundStudent); } } }