public void SetUp()
 {
     testDataHelper = new TestDataHelper();
     var constituent = ConstituentMother.ConstituentWithName(ConstituentNameMother.JamesFranklin());
     savedConstituent = testDataHelper.CreateConstituent(constituent);
     educationDetailRepository = new EducationDetailRepository(testDataHelper.session);
     savedEducationalDetail = testDataHelper.CreateEducationDetail(EducationDetailMother.School(savedConstituent));
 }
 public EducationDetail Update(EducationDetail educationDetail)
 {
     using (var txn = session.BeginTransaction())
     {
         var savedEducationDetail = SaveOrUpdate(educationDetail, txn);
         txn.Commit();
         return savedEducationDetail;
     }
 }
        private void LoadEducationType(EducationDetail educationDetail)
        {
            if (Entity.IsNull(educationDetail.Type))
            {
                throw new BadRequestException("EmailType can not be null");
            }

            educationDetail.Type = repository.Load<EducationType>(educationDetail.Type.Id);
        }
 public static EducationDetailData School(EducationDetail educationDetail)
 {
     return new EducationDetailData
                {
                    Type = new EducationTypeData {Description = "School", Id = 1},
                    Qualification = educationDetail.Qualification,
                    InstituteLocation = educationDetail.InstituteLocation,
                    InstituteName = educationDetail.InstituteName,
                    YearOfGraduation = educationDetail.YearOfGraduation,
                    Constituent = new LinkData {Id = educationDetail.Constituent.Id},
                };
 }
 public EducationDetail UpdateEducationDetail(EducationDetail educationDetail)
 {
     LoadEducationType(educationDetail);
     return repository.Update(educationDetail);
 }
 public EducationDetail CreateEducationDetail(EducationDetail educationDetail)
 {
     LoadEducationType(educationDetail);
     return repository.Save(educationDetail);
 }