/// <summary> /// Search NewsletterMailTranslation by id. /// </summary> /// <param name="request">The NewsletterMailTranslation Request Pivot to retrive.</param> /// <returns>NewsletterMailTranslation Response Pivot response.</returns> public NewsletterMailTranslationResponsePivot FindNewsletterMailTranslations(NewsletterMailTranslationRequestPivot request) { if (request?.NewsletterMailTranslationPivot == null) { throw new ArgumentNullException(nameof(request)); } List <NewsletterMailTranslationPivot> results = new List <NewsletterMailTranslationPivot>(); NewsletterMailTranslationPivot result = new NewsletterMailTranslationPivot(); switch (request.FindNewsletterMailTranslationPivot) { case FindNewsletterMailTranslationPivot.NewsletterMailTranslationId: result = _unitOfWork.NewsletterMailTranslationRepository.Get(f => f.TranslationId == request.NewsletterMailTranslationPivot.TranslationId, null, "Language,NewsletterMail")?.FirstOrDefault().ToPivot(); break; case FindNewsletterMailTranslationPivot.NewsletterMailId: results = _unitOfWork.NewsletterMailTranslationRepository.Get(f => f.NewsletterMailId == request.NewsletterMailTranslationPivot.NewsletterMailId, null, "Language,NewsletterMail")?.ToList().ToPivotList(); break; } return(new NewsletterMailTranslationResponsePivot { NewsletterMailTranslationPivotList = results, NewsletterMailTranslationPivot = result }); }
/// <summary> /// From NewsletterMailTranslationPivot to NewsletterMailTranslation. /// </summary> /// <param name="newsletterMailTranslationPivot">newsletterMailTranslationPivot to assemble.</param> /// <returns>NewsletterMailTranslation result.</returns> public static NewsletterMailTranslation ToEntity(this NewsletterMailTranslationPivot newsletterMailTranslationPivot) { if (newsletterMailTranslationPivot == null) { return(null); } return(new NewsletterMailTranslation() { TranslationId = newsletterMailTranslationPivot.TranslationId, NewsletterMailSource = newsletterMailTranslationPivot.NewsletterMailSource, NewsletterMailSubject = newsletterMailTranslationPivot.NewsletterMailSubject, NewsletterMailId = newsletterMailTranslationPivot.NewsletterMailId, NewsletterMail = newsletterMailTranslationPivot.NewsletterMail?.ToEntity(), LanguageId = newsletterMailTranslationPivot.LanguageId, Language = newsletterMailTranslationPivot.Language?.ToEntity(), }); }