/// <summary> /// Get all publications /// </summary> /// <returns></returns> private async Task <PublicationsViewData> GetPublications() { PublicationResultData publicationResultData = await WebApiClient.GetAsync <PublicationResultData>(Constant.WebApiControllerRessources, Constant.WebApiPublicationList); List <PublicationViewData> publicationList = new List <PublicationViewData>(); if (publicationResultData == null || !publicationResultData.OperationSuccess || publicationResultData.PublicationDtoList == null) { return(null); } foreach (var publicationDto in publicationResultData.PublicationDtoList) { PublicationViewData publication = new PublicationViewData { TranslationsList = await GetpublicationTranslations(publicationDto.PublicationId), ThemesViewData = await GetPublicationThemes(publicationDto.PublicationId), Publication = publicationDto }; publicationList.Add(publication); } PublicationsViewData publicationslistdata = new PublicationsViewData { Publications = publicationList }; return(publicationslistdata); }
/// <summary> /// Sors publications. /// </summary> /// <returns></returns> public async Task <ActionResult> SortPublications(FilterFormData filterFormData) { PublicationsViewData publicationsViewDataFiltred = new PublicationsViewData { Publications = new List <PublicationViewData>() }; PublicationsViewData publicationsViewData = await GetPublications(); foreach (var publicationViewData in publicationsViewData.Publications) { //if (publicationViewData.Publication.AuthorId == filterFormData.AuthorId) //{ // publicationsViewDataFiltred.Publications.Add(publicationViewData); //} if (publicationViewData.ThemesViewData.Themes.Any(t => t.Theme.ThemeId == filterFormData.ThemeId)) { publicationsViewDataFiltred.Publications.Add(publicationViewData); } } return(View("_Publication", publicationsViewDataFiltred)); }