/// <summary> /// Gets all of the translations that contain the given phrase, using that phrase's id. This in /// contrast to searching through all translations' texts and matching up the phrase.text or regex, etc. /// THIS DOES NOT THROW AN EXCEPTION IF THE PHRASE IS NOT FOUND. /// </summary> public static async Task <TranslationList> GetAllTranslationsContainingPhraseByIdAsync(PhraseEdit phrase) { var criteria = new Criteria.PhraseCriteria(phrase); var result = await DataPortal.FetchAsync <TranslationList>(criteria); return(result); }
protected void DataPortal_Fetch(Criteria.PhraseCriteria phraseCriteria) { using (var dalManager = DalFactory.GetDalManager()) { var TranslationDal = dalManager.GetProvider <ITranslationDal>(); Result <ICollection <TranslationDto> > result = TranslationDal.FetchByPhraseId(phraseCriteria.Phrase.Id); if (!result.IsSuccess) { Exception error = result.GetExceptionFromInfo(); if (error != null) { throw error; } else { throw new FetchFailedException(result.Msg); } } //RESULT WAS SUCCESSFUL var translationDtos = result.Obj; foreach (var translationDto in translationDtos) { //var TranslationEdit = DataPortal.CreateChild<TranslationEdit>(TranslationDto); var translationEdit = DataPortal.FetchChild <TranslationEdit>(translationDto); this.Add(translationEdit); } } }
/// <summary> /// Gets all of the translations that contain the given phrase, using that phrase's id. This in /// contrast to searching through all translations' texts and matching up the phrase.text or regex, etc. /// THIS DOES NOT THROW AN EXCEPTION IF THE PHRASE IS NOT FOUND. /// </summary> public static TranslationList GetAllTranslationsContainingPhraseById(PhraseEdit phrase) { var criteria = new Criteria.PhraseCriteria(phrase); return(DataPortal.Fetch <TranslationList>(criteria)); }