public async Task <ActionResult> MainReport(int projectId, string export) { var project = await ProjectRepository.GetProjectWithDetailsAsync(projectId) .ConfigureAwait(false); if (project == null) { return(HttpNotFound()); } if (!project.Details.EnableAccommodation) { return(RedirectToAction("Edit", "Game")); } var accommodations = (await AccommodationRepository.GetClaimAccommodationReport(projectId)).Select(row => new AccomodationReportListItemViewModel { ProjectId = project.ProjectId, ClaimId = row.ClaimId, AccomodationType = row.AccomodationType, RoomName = row.RoomName, DisplayName = row.User.GetDisplayName(), FullName = row.User.FullName, Phone = row.User.Extra?.PhoneNumber, }); var exportType = GetExportTypeByName(export); if (exportType == null) { return(HttpNotFound()); } else { return (await ExportWithCustomFronend(accommodations, "Отчет по расселению", exportType.Value, new AccomodationReportExporter(UriService), project.ProjectName)); } }
public async Task <ActionResult> MainReport(int projectId, string export) { var project = await ProjectRepository.GetProjectWithDetailsAsync(projectId) .ConfigureAwait(false); if (project == null) { return(NotFound()); } if (!project.Details.EnableAccommodation) { return(RedirectToAction("Edit", "Game")); } var accommodations = (await AccommodationRepository.GetClaimAccommodationReport(projectId)).Select(row => new AccomodationReportListItemViewModel { ProjectId = project.ProjectId, ClaimId = row.ClaimId, AccomodationType = row.AccomodationType, RoomName = row.RoomName, DisplayName = row.User.GetDisplayName(), FullName = row.User.FullName, Phone = row.User.Extra?.PhoneNumber, }); var exportType = ExportTypeNameParserHelper.ToExportType(export); if (exportType == null) { return(NotFound()); } else { var generator = ExportDataService.GetGenerator(exportType.Value, accommodations, new AccomodationReportExporter(UriService)); return(await ReturnExportResult(project.ProjectName + ": " + "Отчет по расселению", generator)); } }