예제 #1
0
 public bool SaveStudent(Student student)
 {
     using (SCContext context = new SCContext(_contextName)) {
         IUnitOfWork     uow             = new UnitOfWork(context);
         StudentBusiness studentBusiness = new StudentBusiness(uow);
         bool            saved           = studentBusiness.SaveStudent(student);
         uow.SaveChanges();
         return(saved);
     }
 }
예제 #2
0
 public bool DeleteStudent(long id)
 {
     using (SCContext context = new SCContext(_contextName)) {
         IUnitOfWork     uow             = new UnitOfWork(context);
         StudentBusiness studentBusiness = new StudentBusiness(uow);
         bool            saved           = studentBusiness.SaveStudent(new Student {
             StudentID = id, EntityState = EntityState.Deleted
         });
         uow.SaveChanges();
         return(saved);
     }
 }