コード例 #1
0
        /// <summary>
        /// Search StepParagraphTranslation by id.
        /// </summary>
        /// <param name="request">The StepParagraphTranslation Request Pivot to retrive.</param>
        /// <returns>StepParagraphTranslation Response Pivot response.</returns>
        public StepParagraphTranslationResponsePivot FindStepParagraphTranslations(
            StepParagraphTranslationRequestPivot request)
        {
            if (request?.StepParagraphTranslationPivot == null)
            {
                throw new ArgumentNullException(nameof(request));
            }
            List <StepParagraphTranslationPivot> results = new List <StepParagraphTranslationPivot>();
            StepParagraphTranslationPivot        result  = new StepParagraphTranslationPivot();

            switch (request.FindStepParagraphTranslationPivot)
            {
            case FindStepParagraphTranslationPivot.StepParagraphTranslationId:
                result = _unitOfWork.StepParagraphTranslationRepository
                         .GetById(request.StepParagraphTranslationPivot.TranslationId)?.ToPivot();
                break;

            case FindStepParagraphTranslationPivot.StepParagraphId:
                results = _unitOfWork.StepParagraphTranslationRepository.Get(t => t.ParagraphId == request.StepParagraphTranslationPivot.ParagraphId)?.ToList().ToPivotList();
                break;
            }
            return(new StepParagraphTranslationResponsePivot
            {
                StepParagraphTranslationPivotList = results,
                StepParagraphTranslationPivot = result
            });
        }
コード例 #2
0
/// <summary>
/// From StepParagraphTranslationPivot to StepParagraphTranslation.
/// </summary>
/// <param name="stepParagraphTranslationPivot">stepParagraphTranslationPivot to assemble.</param>
/// <returns>StepParagraphTranslation result.</returns>
        public static StepParagraphTranslation ToStepParagraphTranslation(this StepParagraphTranslationPivot stepParagraphTranslationPivot)
        {
            if (stepParagraphTranslationPivot == null)
            {
                return(null);
            }
            return(new StepParagraphTranslation()
            {
                TranslationId = stepParagraphTranslationPivot.TranslationId,
                ParagraphTitle = stepParagraphTranslationPivot.ParagraphTitle,
                ParagraphDescription = stepParagraphTranslationPivot.ParagraphDescription,
                LanguageId = stepParagraphTranslationPivot.LanguageId,
                Language = stepParagraphTranslationPivot.Language?.ToLanguage(),
                ParagraphId = stepParagraphTranslationPivot.ParagraphId,
                StepParagraph = stepParagraphTranslationPivot.StepParagraph?.ToStepParagraph(),
            });
        }
コード例 #3
0
 /// <summary>
 /// From StepParagraphTranslationPivot to StepParagraphTranslation.
 /// </summary>
 /// <param name="stepParagraphTranslationPivot">stepParagraphTranslationPivot to assemble.</param>
 /// <returns>StepParagraphTranslation result.</returns>
 public static StepParagraphTranslation ToEntity(
     this StepParagraphTranslationPivot stepParagraphTranslationPivot)
 {
     if (stepParagraphTranslationPivot == null)
     {
         return(null);
     }
     return(new StepParagraphTranslation
     {
         ParagraphDescription = stepParagraphTranslationPivot.ParagraphDescription,
         StepParagraph = stepParagraphTranslationPivot.StepParagraph.ToEntity(),
         ParagraphTitle = stepParagraphTranslationPivot.ParagraphTitle,
         Language = stepParagraphTranslationPivot.Language.ToEntity(),
         TranslationId = stepParagraphTranslationPivot.TranslationId,
         ParagraphId = stepParagraphTranslationPivot.ParagraphId,
         LanguageId = stepParagraphTranslationPivot.LanguageId
     });
 }
コード例 #4
0
/// <summary>
/// Search StepParagraphTranslation by id.
/// </summary>
/// <param name="stepParagraphTranslationRequestPivot">The StepParagraphTranslation Request Pivot to retrive.</param>
/// <returns>StepParagraphTranslation Response Pivot response.</returns>
        public StepParagraphTranslationResponsePivot FindStepParagraphTranslation(StepParagraphTranslationRequestPivot stepParagraphTranslationRequestPivot)
        {
            if (stepParagraphTranslationRequestPivot == null)
            {
                throw new Exception("The request pivot is null.");
            }
            List <StepParagraphTranslationPivot> results = new List <StepParagraphTranslationPivot>();
            StepParagraphTranslationPivot        result  = new StepParagraphTranslationPivot();

            switch (stepParagraphTranslationRequestPivot.FindStepParagraphTranslationPivot)
            {
            case FindStepParagraphTranslationPivot.StepParagraphTranslationId:
                result = UnitOfWork.StepParagraphTranslationRepository.GetById(stepParagraphTranslationRequestPivot.StepParagraphTranslationPivot.TranslationId)?.ToPivot();
                break;
            }
            return(new StepParagraphTranslationResponsePivot()
            {
                StepParagraphTranslationPivotList = results,
                StepParagraphTranslationPivot = result
            });
        }