public IEnumerable <TextResourceViewModel> GetTextResource(string screenName, string lang) { var language = _languageRepository.Query(lg => lg.LanguageCode.Equals(lang)).FirstOrDefault(); //var screen = _screenRepository.Query(scr => scr.ScreenName.Contains(screenName)).FirstOrDefault(); var screen = _screenRepository.Query(scr => scr.ScreenName == screenName).FirstOrDefault(); if (screen == null && language == null) { return(null); } IEnumerable <TextResource_D> textResource = null; if (language != null && screen != null) { //screen TransportConfirm using textresource from order screen, dispatch screen if (screen.ScreenID == Convert.ToInt32(Screen.TransportConfirm)) { var dispatchScrId = Convert.ToInt32(Screen.Dispatch); var orderScrId = Convert.ToInt32(Screen.Order); textResource = _textResourceRepository.Query( t => t.LanguageID == language.LanguageID && (t.ScreenID == screen.ScreenID || t.ScreenID == dispatchScrId || t.ScreenID == orderScrId)); } else { textResource = _textResourceRepository.Query( t => t.LanguageID == language.LanguageID && t.ScreenID == screen.ScreenID); } } if (textResource == null) { return(null); } var destination = Mapper.Map <IEnumerable <TextResource_D>, IEnumerable <TextResourceViewModel> >(textResource); return(destination); }