Пример #1
0
        /// <summary>
        /// Remove ActivityParagraphTraslation.
        /// </summary>
        /// <param name="request">The ActivityParagraphTraslation Request Pivot to remove.</param>
        public void DeleteActivityParagraphTranslation(ActivityParagraphTranslationRequestPivot request)
        {
            if (request?.ActivityParagraphTranslationPivot == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            ActivityParagraphTranslation activityParagraphTraslation = _unitOfWork.ActivityParagraphTraslationRepository.GetById(request.ActivityParagraphTranslationPivot.TranslationId);

            _unitOfWork.ActivityParagraphTraslationRepository.Delete(activityParagraphTraslation);
            _unitOfWork.Save();
        }
Пример #2
0
        /// <summary>
        /// Change ActivityParagraphTraslation values.
        /// </summary>
        /// <param name="request">The ActivityParagraphTraslation Request Pivot to change.</param>
        public void UpdateActivityParagraphTranslation(ActivityParagraphTranslationRequestPivot request)
        {
            if (request?.ActivityParagraphTranslationPivot == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            ActivityParagraphTranslation activityTranslation = _unitOfWork.ActivityParagraphTraslationRepository.GetById(request.ActivityParagraphTranslationPivot.TranslationId);

            activityTranslation.ParagraphDescription = request.ActivityParagraphTranslationPivot.ParagraphDescription;
            activityTranslation.ParagraphTitle       = request.ActivityParagraphTranslationPivot.ParagraphTitle;
            _unitOfWork.Save();
        }
Пример #3
0
        /// <summary>
        /// Change ActivityParagraphTraslation values Range.
        /// </summary>
        /// <param name="request">The ActivityParagraphTraslation Request Pivot to change.</param>
        public void UpdateActivityParagraphTranslationRange(ActivityParagraphTranslationRequestPivot request)
        {
            if (request?.ActivityParagraphTranslationPivotList == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            foreach (var translation in request.ActivityParagraphTranslationPivotList.ToList())
            {
                ActivityParagraphTranslation activityTranslation = _unitOfWork.ActivityParagraphTraslationRepository.GetById(translation.TranslationId);
                activityTranslation.ParagraphDescription = translation.ParagraphDescription;
                activityTranslation.ParagraphTitle       = translation.ParagraphTitle;
                _unitOfWork.Save();
            }
        }
Пример #4
0
        /// <summary>
        /// Create new ActivityParagraphTraslation.
        /// </summary>
        /// <param name="request">The ActivityParagraphTraslation Request Pivot to add.</param>
        /// <returns>ActivityParagraphTraslation Response Pivot added.</returns>
        public ActivityParagraphTranslationResponsePivot CreateActivityParagraphTranslation(ActivityParagraphTranslationRequestPivot request)
        {
            if (request?.ActivityParagraphTranslationPivot == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            ActivityParagraphTranslation activityParagraphTraslation = request.ActivityParagraphTranslationPivot.ToEntity();

            _unitOfWork.ActivityParagraphTraslationRepository.Insert(activityParagraphTraslation);
            _unitOfWork.Save();

            return(new ActivityParagraphTranslationResponsePivot
            {
                ActivityParagraphTranslationPivot = activityParagraphTraslation.ToPivot()
            });
        }
 /// <summary>
 /// From ActivityParagraphTraslation To ActivityParagraphTraslation Pivot.
 /// </summary>
 /// <param name="activityParagraphTraslation">activityParagraphTraslation TO ASSEMBLE</param>
 /// <returns>ActivityParagraphTranslationPivot result.</returns>
 public static ActivityParagraphTranslationPivot ToPivot(this ActivityParagraphTranslation activityParagraphTraslation)
 {
     if (activityParagraphTraslation == null)
     {
         return(null);
     }
     return(new ActivityParagraphTranslationPivot
     {
         ActivityParagraph = activityParagraphTraslation.ActivityParagraph?.ToPivot(),
         ParagraphDescription = activityParagraphTraslation.ParagraphDescription,
         ParagraphTitle = activityParagraphTraslation.ParagraphTitle,
         Language = activityParagraphTraslation.Language?.ToPivot(),
         TranslationId = activityParagraphTraslation.TranslationId,
         ParagraphId = activityParagraphTraslation.ParagraphId,
         LanguageId = activityParagraphTraslation.LanguageId
     });
 }