Exemple #1
0
        private void InitializeStudyDatas()
        {
            var dto = new StudyDataDto()
            {
                Id = new Guid("A1F69CEE-05EC-49D2-AA58-A246A8371AC0"),
                NativeLanguageText = EnglishText,
                Username           = TestValidUsername
            };

            StudyDatas = new List <StudyDataDto>()
            {
                dto
            };
        }
        public Result <StudyDataDto> Insert(StudyDataDto dtoToInsert)
        {
            Result <StudyDataDto> retResult = Result <StudyDataDto> .Undefined(null);

            try
            {
                Common.CommonHelper.CheckAuthentication();

                var insertedDto = InsertImpl(dtoToInsert);
                retResult = Result <StudyDataDto> .Success(insertedDto);
            }
            catch (Exception ex)
            {
                var wrappedEx = new Exceptions.InsertFailedException(ex);
                retResult = Result <StudyDataDto> .FailureWithInfo(null, wrappedEx);
            }
            return(retResult);
        }
        public Result <StudyDataDto> Update(StudyDataDto dtoToUpdate)
        {
            Result <StudyDataDto> retResult = Result <StudyDataDto> .Undefined(null);

            try
            {
                Common.CommonHelper.CheckAuthentication();

                var updatedDto = UpdateImpl(dtoToUpdate);
                retResult = Result <StudyDataDto> .Success(updatedDto);
            }
            catch (Exception ex)
            {
                var wrappedEx = new Exceptions.UpdateFailedException(ex);
                retResult = Result <StudyDataDto> .FailureWithInfo(null, wrappedEx);
            }
            return(retResult);
        }
 protected abstract StudyDataDto InsertImpl(StudyDataDto dto);
 //protected abstract StudyDataDto FetchImpl(Guid id);
 //protected abstract ICollection<StudyDataDto> FetchImpl(ICollection<Guid> ids);
 protected abstract StudyDataDto UpdateImpl(StudyDataDto dto);
 //protected abstract StudyDataDto FetchImpl(Guid id);
 //protected abstract ICollection<StudyDataDto> FetchImpl(ICollection<Guid> ids);
 protected abstract StudyDataDto UpdateImpl(StudyDataDto dto);
 protected abstract StudyDataDto InsertImpl(StudyDataDto dto);
        public Result<StudyDataDto> Update(StudyDataDto dtoToUpdate)
        {
            Result<StudyDataDto> retResult = Result<StudyDataDto>.Undefined(null);
              try
              {
            Common.CommonHelper.CheckAuthentication();

            var updatedDto = UpdateImpl(dtoToUpdate);
            retResult = Result<StudyDataDto>.Success(updatedDto);
              }
              catch (Exception ex)
              {
            var wrappedEx = new Exceptions.UpdateFailedException(ex);
            retResult = Result<StudyDataDto>.FailureWithInfo(null, wrappedEx);
              }
              return retResult;
        }
        public Result<StudyDataDto> Insert(StudyDataDto dtoToInsert)
        {
            Result<StudyDataDto> retResult = Result<StudyDataDto>.Undefined(null);
              try
              {
            Common.CommonHelper.CheckAuthentication();

            var insertedDto = InsertImpl(dtoToInsert);
            retResult = Result<StudyDataDto>.Success(insertedDto);
              }
              catch (Exception ex)
              {
            var wrappedEx = new Exceptions.InsertFailedException(ex);
            retResult = Result<StudyDataDto>.FailureWithInfo(null, wrappedEx);
              }
              return retResult;
        }
 private void InitializeStudyDatas()
 {
     var dto = new StudyDataDto()
       {
     Id = new Guid("A1F69CEE-05EC-49D2-AA58-A246A8371AC0"),
     NativeLanguageText = EnglishText,
     Username = TestValidUsername
       };
       StudyDatas = new List<StudyDataDto>()
       {
     dto
       };
 }