예제 #1
0
        public List <Student> GetData()
        {
            List <Student>      studentList = new List <Student>();
            students_dbEntities dbAccess    = new students_dbEntities();

            dbAccess.student.ToList().ForEach(x => studentList.Add(new Student
            {
                Student_Name       = x.STUDENT_NAME, Student_LastName = x.STUDENT_LNAME,
                Student_Birth_Date = x.STUDENT_BIRTH_DATE
            }));
            return(studentList);
        }
예제 #2
0
        public bool SetData(Student value)
        {
            students_dbEntities dbAccess = new students_dbEntities();
            student             dataIn   = new student
            {
                //ID = 1,
                STUDENT_NAME       = value.Student_Name,
                STUDENT_LNAME      = value.Student_LastName,
                STUDENT_BIRTH_DATE = value.Student_Birth_Date
            };

            Debug.WriteLine("Transaction Started");
            try
            {
                dbAccess.student.Add(dataIn);
                dbAccess.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }
            return(false);
        }