/// <summary> /// Remove SectionFileTranslation. /// </summary> /// <param name="request">The SectionFileTranslation Request Pivot to remove.</param> public void DeleteSectionFileTranslation(SectionFileTranslationRequestPivot request) { if (request?.SectionFileTranslationPivot == null) { throw new ArgumentNullException(nameof(request)); } SectionFileTranslation sectionFileTranslation = _unitOfWork.SectionFileTranslationRepository.GetById(request.SectionFileTranslationPivot.TranslationId); _unitOfWork.SectionFileTranslationRepository.Delete(sectionFileTranslation); _unitOfWork.Save(); }
/// <summary> /// Create new SectionFileTranslation. /// </summary> /// <param name="request">The SectionFileTranslation Request Pivot to add.</param> /// <returns>SectionFileTranslation Response Pivot created.</returns> public SectionFileTranslationResponsePivot CreateSectionFileTranslation(SectionFileTranslationRequestPivot request) { if (request?.SectionFileTranslationPivot == null) { throw new ArgumentNullException(nameof(request)); } SectionFileTranslation sectionFileTranslation = request.SectionFileTranslationPivot.ToEntity(); _unitOfWork.SectionFileTranslationRepository.Insert(sectionFileTranslation); _unitOfWork.Save(); return(new SectionFileTranslationResponsePivot { SectionFileTranslationPivot = sectionFileTranslation.ToPivot() }); }
/// <summary> /// Change SectionFileTranslation values. /// </summary> /// <param name="request">The SectionFileTranslation Request Pivot to change.</param> public void UpdateSectionFileTranslation(SectionFileTranslationRequestPivot request) { if (request?.SectionFileTranslationPivot == null) { throw new ArgumentNullException(nameof(request)); } SectionFileTranslation sectionFileTranslation = _unitOfWork.SectionFileTranslationRepository.GetById(request.SectionFileTranslationPivot.TranslationId); if (request.SectionFileTranslationPivot.SectionFileSource != null) { sectionFileTranslation.SectionFileSource = request.SectionFileTranslationPivot.SectionFileSource; } sectionFileTranslation.SectionFileText = request.SectionFileTranslationPivot.SectionFileText; _unitOfWork.Save(); }
/// <summary> /// From SectionFileTranslation To SectionFileTranslation Pivot. /// </summary> /// <param name="sectionFileTranslation">sectionFileTranslation TO ASSEMBLE</param> /// <returns>SectionFileTranslationPivot result.</returns> public static SectionFileTranslationPivot ToPivot(this SectionFileTranslation sectionFileTranslation) { if (sectionFileTranslation == null) { return(null); } return(new SectionFileTranslationPivot { SectionFileSource = sectionFileTranslation.SectionFileSource, SectionFile = sectionFileTranslation.SectionFile?.ToPivot(), SectionFileText = sectionFileTranslation.SectionFileText, SectionFileId = sectionFileTranslation.SectionFileId, Language = sectionFileTranslation.Language?.ToPivot(), TranslationId = sectionFileTranslation.TranslationId, LanguageId = sectionFileTranslation.LanguageId }); }
/// <summary> /// Change SectionFileTranslation values. /// </summary> /// <param name="request">The SectionFileTranslation Request Pivot to change.</param> public void UpdateSectionFileTranslationRange(SectionFileTranslationRequestPivot request) { if (request?.SectionFileTranslationPivotList == null) { throw new ArgumentNullException(nameof(request)); } foreach (var translation in request.SectionFileTranslationPivotList) { SectionFileTranslation sectionFileTranslation = _unitOfWork.SectionFileTranslationRepository.GetById(translation.TranslationId); if (translation.SectionFileSource != null) { sectionFileTranslation.SectionFileSource = translation.SectionFileSource; } sectionFileTranslation.SectionFileText = translation.SectionFileText; _unitOfWork.Save(); } }