{"id":22180105,"url":"https://github.com/sultanimbayev/ieit.reports.webframework","last_synced_at":"2026-04-30T17:31:57.759Z","repository":{"id":21480747,"uuid":"93034926","full_name":"sultanimbayev/IEIT.Reports.WebFramework","owner":"sultanimbayev","description":"File downloading framework for ASP.NET MVC","archived":false,"fork":false,"pushed_at":"2023-05-31T18:37:59.000Z","size":12780,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-28T11:20:53.605Z","etag":null,"topics":["api","csharp","dotnet","file-download","net45"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sultanimbayev.png","metadata":{"files":{"readme":"README-eng.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-01T08:31:31.000Z","updated_at":"2020-03-12T03:42:45.000Z","dependencies_parsed_at":"2024-12-02T09:17:03.074Z","dependency_job_id":"33017bc7-7b3a-4286-9937-32e3bfb07193","html_url":"https://github.com/sultanimbayev/IEIT.Reports.WebFramework","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sultanimbayev%2FIEIT.Reports.WebFramework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sultanimbayev%2FIEIT.Reports.WebFramework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sultanimbayev%2FIEIT.Reports.WebFramework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sultanimbayev%2FIEIT.Reports.WebFramework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sultanimbayev","download_url":"https://codeload.github.com/sultanimbayev/IEIT.Reports.WebFramework/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245331282,"owners_count":20597938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","csharp","dotnet","file-download","net45"],"created_at":"2024-12-02T09:16:57.662Z","updated_at":"2026-04-30T17:31:57.726Z","avatar_url":"https://github.com/sultanimbayev.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IEIT.Reports.WebFramework\n\nFramework for file downloading in ASP.NET MVC.\n\n## Installing\n\nInstall using NuGet package manager:\n\n```\nPM\u003e Install-Package IEIT.Reports.WebFramework.Api\n```\n\n## How to use\n\nCreate a class at any place in your web project and add the namespaces:\n```C#\nusing IEIT.Reports.WebFramework.Core.Attributes;\nusing IEIT.Reports.WebFramework.Core.Interfaces;\n```\n\nThen:\n 1. Add the `Report` attribute to the class.\n 2. Implement the `IReport` interface in your class. \n\nExample:\n\n```C#\n[Report]\npublic class MyFileReport: IReport\n{\n    public void GenerateFiles(NameValueCollection queryParams, string inDir)\n    {\n        var name = queryParams[\"name\"] ?? \"there\";\n        var path = Path.Combine(inDir, \"newFile.txt\");\n        File.WriteAllText(path, $\"Hello {name}!\");\n    }\n\n}\n```\n\nAfter doing this, you can download your file via the `/api/Files/DownloadForm/MyFile?name=Sultan` url.\n\n`queryParams` - GET Parameters of the request\n\n`inDir` - directory path where your files that are to be downloaded, should be created.\n\n\u003e When you use `[Report]` attribute without parameters, download link is formed using the name \n\u003e of the class which lies under `[Report]` attribute. If you want to overwrite this name pass a string\n\u003e to `[Report]` attribute. For example  `[Report(\"NotMyFile\")]`.\n\nIf you want to place this class in a different project than the controller is placed you have to add a reference to that project, and install the \nIEIT.Reports.WebFramework.Core package to it.\n\n\n### How does it work?\n\nAfter installation, `ReportExportController.cs` were created in `~\\Controllers\\` directory. In which you will find the following constant:\n\n\u003e where `~` is the home directory of your web project.\n\n```C#\nprivate const string API_ROUTE_BASE = \"api/Files/DownloadForm/\";\n```\n\nIt is the url for downloading. Remember it to download and check your files that you make downloadable.\n\nCreated controller contains all logic that does all of this stuff. Detail are hidden in the methods of this library.\nIf you are interested how does it work, you can go through the code here, in GitHub.\n\n### ReturnsZip attribute\n\nIf you create one file in the `inDir` directory, then, this file is sent to the client.\nBut, if you create there two or more files it will send a .zip archive containig that files.\nUse ReturnsZip attribute to define the name of the archive.\n\nExample:\n```C#\n[Report]\n[ReturnsZip(\"My archive\")]\npublic class MyFileReport: IReport\n{\n    //...\n}\n```\n\nIf you don't define the name of an archive it the name will be \"Выходные данные\" as default.\n\n\u003e If you have placed the `ReturnsZip` attribute, then it does not matter that do you create one file or more, it \n\u003e will send all files in the archive anyway.\n\n### DisplayName attribute\n\nIf you want to declare and share the display names of the reports you create, then, you can use this attribute.\n\nExample:\n```C#\n[Report]\n[DisplayName(DisplayLanguage.English, \"Download my files\")]\npublic class MyFileReport: IReport\n{\n    //...\n}\n```\n\nUse the `LangUtils` class to get the names you have assigned.\n`LangUtils` is placed in the `IEIT.Reports.WebFramework.Api.Resolvers` namespace.\n\nFor example, if you want to get the display name of the report in the example above:\n```C#\nvar name = LangUtils.GetDisplayName(\"MyFile\", DisplayLanguage.English);\nConsole.WriteLine($\"Name of the report is: {name}\");\n```\n\nYou can include multiple `DisplayName` attributes on a class with different value of `DisplayLanguage`.\nIt means that you can make display name of the report in several languages.\n\nYou can also, take the display names of all report classes with their corresponding class name:\n```C#\nvar names = LangUtils.GetDisplayNames(DisplayLanguage.English);\nforeach(var pair in names)\n{\n\tConsole.WriteLine($\"Display name: {pair.Value}, class name: {pair.Key}\");\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsultanimbayev%2Fieit.reports.webframework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsultanimbayev%2Fieit.reports.webframework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsultanimbayev%2Fieit.reports.webframework/lists"}