/// <summary> /// From REQUESTDATA To FORMDATA /// </summary> /// <param name="requestData"></param> /// <returns></returns> public static PublicationThemeFormData ToFormData(this PublicationThemeRequestData requestData) { if (requestData?.PublicationThemeDto == null) { return(new PublicationThemeFormData()); } return(new PublicationThemeFormData { PublicationThemeId = requestData.PublicationThemeDto.PublicationThemeId, PublicationId = requestData.PublicationThemeDto.PublicationId, ThemeId = requestData.PublicationThemeDto.ThemeId }); }
/// <summary> /// Get publicationThemes list. /// </summary> /// <returns>publications view.</returns> public async Task <ThemesViewData> GetPublicationThemes(int publicationId) { ThemesViewData themesViewData = new ThemesViewData { Themes = new List <ThemeViewData>() }; PublicationThemeRequestData findPublicationThemeRequest = new PublicationThemeRequestData { PublicationThemeDto = new PublicationThemeItemData { PublicationId = publicationId }, FindPublicationThemeDto = FindPublicationThemeItemData.PublicationId }; PublicationThemeResultData publicationThemeResultData = await WebApiClient.PostFormJsonAsync <PublicationThemeRequestData, PublicationThemeResultData>( Constant.WebApiControllerRessources, Constant.WebApiFindPublicationThemes, findPublicationThemeRequest); if (!publicationThemeResultData.ThemeTranslationDtoList.Any()) { return(themesViewData); } foreach (var themeTranslationItemData in publicationThemeResultData.ThemeTranslationDtoList.Where(t => t.LanguageId == _lang).ToList()) { ThemeViewData themeViewData = new ThemeViewData { Theme = new ThemeItemData { ThemeId = themeTranslationItemData.Theme.ThemeId }, TranslationsList = new List <ThemeTranslationItemData>() }; themeViewData.TranslationsList.Add(themeTranslationItemData); themesViewData.Themes.Add(themeViewData); } return(themesViewData); }