public void PublishEnrollPlan(UniversityEnrollPlan enrollPlan) { if (enrollPlan == null) throw new ArgumentNullException("enrollPlan"); using (UniversityEnrollPlanRepository enrollPlanRepository = new UniversityEnrollPlanRepository()) { var ens = enrollPlanRepository.GetFiltered(e => e.Year.Year == enrollPlan.Year.Year && e.Province == enrollPlan.Province && e.UniversityId == enrollPlan.UniversityId); if (ens != null) { // TODO: throw existing exception } enrollPlanRepository.Add(enrollPlan); enrollPlanRepository.Commit(); } }
public void RemoveEnrollPlan(Guid enrollPlanId) { using (UniversityEnrollPlanRepository enrollPlanRepository = new UniversityEnrollPlanRepository()) { var enrollPlan = enrollPlanRepository.Get(enrollPlanId); if (enrollPlan != null) { enrollPlanRepository.Remove(enrollPlan); enrollPlanRepository.Commit(); } } }
public void UpdateEnrollPlan(UniversityEnrollPlan enrollPlan) { if (enrollPlan == null) throw new ArgumentNullException("enrollPlan"); using (UniversityEnrollPlanRepository enrollPlanRepository = new UniversityEnrollPlanRepository()) { var enroll = enrollPlanRepository.Get(enrollPlan.Id); if (enroll == null) { // TODO: throw not existing exception } enrollPlanRepository.Modify(enrollPlan); enrollPlanRepository.Commit(); } }