Esempio n. 1
0
       public StudentModel  InsertStudent(tblStudent tblstudobj , tblStudentHistory tblhisobj)
       {

           using (StudentInformationSystemEntities db = new StudentInformationSystemEntities())
           {
               tblstudobj.ID = Guid.NewGuid();
               tblhisobj.ID = Guid.NewGuid();

               db.tblStudent.Add(tblstudobj);
              int j =  db.SaveChanges();
              
              var studid = (from t in db.tblStudent orderby t.ID
                             select t ).ToList().Last();
              
             

               tblhisobj.StudentID = studid.ID;

               db.tblStudentHistory.Add(tblhisobj);
               int i =  db.SaveChanges();
               if (i == 1&&j==0)

                   return new StudentModel();
               else return null; ;
           }

       }
Esempio n. 2
0
       public List<SIS_DataAccessLayer.tblStudent> ViewAll()
       {

           using (StudentInformationSystemEntities db = new StudentInformationSystemEntities())
           {
               return db.tblStudent.ToList();
           }


       }
Esempio n. 3
0
        public bool DeleteStudent(tblStudent tblstudobj, tblStudentHistory tblstudhisobj
            {

            bool result = false;
            using (StudentInformationSystemEntities db = new StudentInformationSystemEntities())
            {
                StudentModel student = db.tblStudent.Where(x => x.ID == tblstudobj.ID).Select(x => x).FirstOrDefault();
                db.tblStudent.DeleteObject(student);
                db.SaveChanges();
                result = true;
            }
            return result;
        }