Beispiel #1
0
        public async Task <ActionResult> ByGroup(int projectId, int characterGroupId, string export)
        {
            var characterGroup = await ProjectRepository.GetGroupAsync(projectId, characterGroupId);

            var groupIds = await GetChildrenGroupIds(projectId, characterGroupId);

            var characters =
                (await ProjectRepository.GetCharacterByGroups(projectId, groupIds)).Where(ch => ch.IsActive).ToList();

            if (characterGroup == null)
            {
                return(NotFound());
            }

            var plots = await PlotRepository.GetPlotsWithTargets(projectId);

            var list = new CharacterListByGroupViewModel(CurrentUserId,
                                                         characters, characterGroup);

            var exportType = ExportTypeNameParserHelper.ToExportType(export);

            if (exportType == null)
            {
                return(View("ByGroup", list));
            }

            return(await Export(list, exportType));
        }
Beispiel #2
0
        public async Task <ActionResult> ByGroup(int projectId, int characterGroupId, string export)
        {
            var characterGroup = await ProjectRepository.GetGroupAsync(projectId, characterGroupId);

            var groupIds = await GetChildrenGroupIds(projectId, characterGroupId);

            var characters =
                (await ProjectRepository.GetCharacterByGroups(projectId, groupIds)).Where(ch => ch.IsActive).ToList();

            if (characterGroup == null)
            {
                return(HttpNotFound());
            }

            var plots = await PlotRepository.GetPlotsWithTargets(projectId);

            var list = new CharacterListByGroupViewModel(CurrentUserId,
                                                         characters, characterGroup);

            var exportType = GetExportTypeByName(export);

            if (exportType == null)
            {
                return(View("ByGroup", list));
            }

            return(await ExportWithCustomFronend(list.Items, list.Title, exportType.Value,
                                                 new CharacterListItemViewModelExporter(list.Fields, UriService), list.ProjectName));
        }