public async Task <GetProjectExportDTO> GetProjectExportDTOAsync(string viewKey)
        {
            // Get the data
            List <int> reservationIds = await getReservationIdsForPortfolio(viewKey);

            var projects = await getProjectsAsArrayWitUpdatesAsync(reservationIds);

            var config = await portfolioService.GetConfigAsync(viewKey);

            // To the mapping
            GetProjectExportDTO result = new GetProjectExportDTO()
            {
                Config   = PortfolioMapper.GetProjectLabelConfigModel(config, includedOnly: true),
                Projects = PortfolioMapper.ExportMapper.Map <IEnumerable <ProjectExportModel> >(projects,
                                                                                                opts => {
                    opts.Items[ExportUpdateTextResolver.OnKey] = true;
                })
            };

            return(result);
        }
Exemplo n.º 2
0
        public async Task <GetProjectQueryDTO> FilterOptionsAsync([FromUri(Name = "portfolio")] string viewKey)
        {
            GetProjectQueryDTO result = null;

            using (var context = new PortfolioContext())
            {
                var config = await portfolioService.GetConfigAsync(viewKey);

                var customFields = portfolioService.GetCustomFilterLabels(config);

                result = new GetProjectQueryDTO()
                {
                    Config  = PortfolioMapper.GetProjectLabelConfigModel(config, PortfolioFieldFlags.FilterProject | PortfolioFieldFlags.FilterRequired, customLabels: customFields),
                    Options = await portfolioService.GetNewProjectOptionsAsync(config)
                };
            }
            return(result);
        }