WIP: ZugferdRESTService
This commit is contained in:
parent
1c2fb43f6a
commit
540d021e27
@ -104,6 +104,10 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GUIs.Test.DocumentViewerTes
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DDEmailService", "DDEmailService\DDEmailService.vbproj", "{83ED2617-B398-4859-8F59-B38F8807E83E}"
|
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DDEmailService", "DDEmailService\DDEmailService.vbproj", "{83ED2617-B398-4859-8F59-B38F8807E83E}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebServices", "WebServices", "{D3BAE68E-406E-493D-A4E5-DB6EDDFFB371}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZUGFeRDRESTService", "WEBSERVICES\ZUGFeRDRESTService\ZUGFeRDRESTService.csproj", "{FD50590A-59C1-4798-AD90-419A588DCE76}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -270,6 +274,10 @@ Global
|
|||||||
{83ED2617-B398-4859-8F59-B38F8807E83E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{83ED2617-B398-4859-8F59-B38F8807E83E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{83ED2617-B398-4859-8F59-B38F8807E83E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{83ED2617-B398-4859-8F59-B38F8807E83E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{83ED2617-B398-4859-8F59-B38F8807E83E}.Release|Any CPU.Build.0 = Release|Any CPU
|
{83ED2617-B398-4859-8F59-B38F8807E83E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{FD50590A-59C1-4798-AD90-419A588DCE76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{FD50590A-59C1-4798-AD90-419A588DCE76}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{FD50590A-59C1-4798-AD90-419A588DCE76}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{FD50590A-59C1-4798-AD90-419A588DCE76}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@ -315,6 +323,7 @@ Global
|
|||||||
{609B09B4-AD1E-40F7-8899-A6685924621C} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A}
|
{609B09B4-AD1E-40F7-8899-A6685924621C} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A}
|
||||||
{F9CCEFCD-21B3-4319-9DB1-A0756DA5BA1C} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A}
|
{F9CCEFCD-21B3-4319-9DB1-A0756DA5BA1C} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A}
|
||||||
{83ED2617-B398-4859-8F59-B38F8807E83E} = {7AF3F9C2-C939-4A08-95C1-0453207E298A}
|
{83ED2617-B398-4859-8F59-B38F8807E83E} = {7AF3F9C2-C939-4A08-95C1-0453207E298A}
|
||||||
|
{FD50590A-59C1-4798-AD90-419A588DCE76} = {D3BAE68E-406E-493D-A4E5-DB6EDDFFB371}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {C1BE4090-A0FD-48AF-86CB-39099D14B286}
|
SolutionGuid = {C1BE4090-A0FD-48AF-86CB-39099D14B286}
|
||||||
|
|||||||
@ -0,0 +1,53 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace ZUGFeRDRESTService.Controllers
|
||||||
|
{
|
||||||
|
public class ZugferdValidationResponse
|
||||||
|
{
|
||||||
|
public string status;
|
||||||
|
public string message;
|
||||||
|
public List<string> errors;
|
||||||
|
|
||||||
|
public static string RESPONSE_OK = "OK";
|
||||||
|
public static string RESPONSE_ERROR = "ERROR";
|
||||||
|
|
||||||
|
public ZugferdValidationResponse()
|
||||||
|
{
|
||||||
|
status = RESPONSE_OK;
|
||||||
|
message = String.Empty;
|
||||||
|
errors = new List<string>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
[ApiController]
|
||||||
|
public class ZugferdValidationController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IZugferdValidationDataService _dataService;
|
||||||
|
|
||||||
|
public ZugferdValidationController(IZugferdValidationDataService dataService)
|
||||||
|
{
|
||||||
|
_dataService = dataService;
|
||||||
|
}
|
||||||
|
|
||||||
|
// POST: api/ZugferdValidation
|
||||||
|
[HttpPost]
|
||||||
|
public ZugferdValidationResponse Post(List<IFormFile> files)
|
||||||
|
{
|
||||||
|
var oFiles = files;
|
||||||
|
var oResponse = new ZugferdValidationResponse
|
||||||
|
{
|
||||||
|
message = "You uploaded " + oFiles.Count + " files."
|
||||||
|
};
|
||||||
|
|
||||||
|
return oResponse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ZUGFeRDRESTService
|
||||||
|
{
|
||||||
|
public interface IZugferdValidationDataService
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
16
WEBSERVICES/ZUGFeRDRESTService/Pages/Index.cshtml
Normal file
16
WEBSERVICES/ZUGFeRDRESTService/Pages/Index.cshtml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
@page
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "UploadTest";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h1>UploadTest</h1>
|
||||||
|
|
||||||
|
<form method="post" action="/api/zugferdvalidation" enctype="multipart/form-data" >
|
||||||
|
<p>
|
||||||
|
<span>PDF Datei:</span>
|
||||||
|
<input type="file" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<button type="submit">Submit</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
17
WEBSERVICES/ZUGFeRDRESTService/Pages/Index.cshtml.cs
Normal file
17
WEBSERVICES/ZUGFeRDRESTService/Pages/Index.cshtml.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
|
namespace ZUGFeRDRESTService
|
||||||
|
{
|
||||||
|
public class UploadTestModel : PageModel
|
||||||
|
{
|
||||||
|
public void OnGet()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
WEBSERVICES/ZUGFeRDRESTService/Program.cs
Normal file
26
WEBSERVICES/ZUGFeRDRESTService/Program.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace ZUGFeRDRESTService
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
CreateHostBuilder(args).Build().Run();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||||
|
Host.CreateDefaultBuilder(args)
|
||||||
|
.ConfigureWebHostDefaults(webBuilder =>
|
||||||
|
{
|
||||||
|
webBuilder.UseStartup<Startup>();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:52235",
|
||||||
|
"sslPort": 44388
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"profiles": {
|
||||||
|
"IIS Express": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "api/zugferdvalidation",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ZUGFeRDRESTService": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "api/zugferdvalidation",
|
||||||
|
"applicationUrl": "https://localhost:5001;http://localhost:5000",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
54
WEBSERVICES/ZUGFeRDRESTService/Startup.cs
Normal file
54
WEBSERVICES/ZUGFeRDRESTService/Startup.cs
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.HttpsPolicy;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace ZUGFeRDRESTService
|
||||||
|
{
|
||||||
|
public class Startup
|
||||||
|
{
|
||||||
|
public Startup(IConfiguration configuration)
|
||||||
|
{
|
||||||
|
Configuration = configuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IConfiguration Configuration { get; }
|
||||||
|
|
||||||
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
|
public void ConfigureServices(IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddControllers().AddNewtonsoftJson();
|
||||||
|
services.AddRazorPages();
|
||||||
|
services.AddTransient<IZugferdValidationDataService, ZugferdValidationDataService>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
|
{
|
||||||
|
if (env.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseDeveloperExceptionPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
|
app.UseRouting();
|
||||||
|
|
||||||
|
app.UseAuthorization();
|
||||||
|
|
||||||
|
app.UseEndpoints(endpoints =>
|
||||||
|
{
|
||||||
|
endpoints.MapControllers();
|
||||||
|
endpoints.MapRazorPages();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
WEBSERVICES/ZUGFeRDRESTService/ZUGFeRDRESTService.csproj
Normal file
13
WEBSERVICES/ZUGFeRDRESTService/ZUGFeRDRESTService.csproj
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.2" />
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
|
</Project>
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ZUGFeRDRESTService
|
||||||
|
{
|
||||||
|
public class ZugferdValidationDataService: IZugferdValidationDataService
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft": "Warning",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10
WEBSERVICES/ZUGFeRDRESTService/appsettings.json
Normal file
10
WEBSERVICES/ZUGFeRDRESTService/appsettings.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft": "Warning",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user