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); } }
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); } }