Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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 CreateActivityParagraphTranslationRange(ActivityParagraphTranslationRequestPivot request)
        {
            if (request?.ActivityParagraphTranslationPivotList == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            List <ActivityParagraphTranslation> activityParagraphTraslationList = request.ActivityParagraphTranslationPivotList.ToEntityList();

            _unitOfWork.ActivityParagraphTraslationRepository.Insert(activityParagraphTraslationList);
            _unitOfWork.Save();
            return(new ActivityParagraphTranslationResponsePivot
            {
                ActivityParagraphTranslationPivotList = activityParagraphTraslationList.ToPivotList()
            });
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Search ActivityParagraphTraslation by id.
        /// </summary>
        /// <param name="request">The ActivityParagraphTraslation Request Pivot to retrive.</param>
        /// <returns>ActivityParagraphTraslation Response Pivot response.</returns>
        public ActivityParagraphTranslationResponsePivot FindActivityParagraphTranslations(ActivityParagraphTranslationRequestPivot request)
        {
            if (request?.ActivityParagraphTranslationPivot == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            List <ActivityParagraphTranslationPivot> results = new List <ActivityParagraphTranslationPivot>();
            ActivityParagraphTranslationPivot        result  = new ActivityParagraphTranslationPivot();

            switch (request.FindActivityParagraphTranslationPivot)
            {
            case FindActivityParagraphTranslationPivot.ActivityParagraphTranslationId:
                result = _unitOfWork.ActivityParagraphTraslationRepository.Get(p => p.ParagraphId == request.ActivityParagraphTranslationPivot.TranslationId, null, "ActivityParagraph,Language")?.FirstOrDefault()?.ToPivot();
                break;

            case FindActivityParagraphTranslationPivot.ActivityParagraphId:
                results = _unitOfWork.ActivityParagraphTraslationRepository.Get(p => p.ParagraphId == request.ActivityParagraphTranslationPivot.ParagraphId, null, "ActivityParagraph,Language")?.ToList().ToPivotList();
                break;
            }
            return(new ActivityParagraphTranslationResponsePivot
            {
                ActivityParagraphTranslationPivotList = results,
                ActivityParagraphTranslationPivot = result
            });
        }