From 4c201db61bd286a8cdfa10d114c1bffafd2281ef Mon Sep 17 00:00:00 2001 From: Marcus Ferl Date: Sat, 8 Jul 2023 19:38:59 +0200 Subject: [PATCH] Add project files. --- Weiferl.Api.sln | 25 +++++++++++ .../Controllers/HelloWorldController.cs | 26 ++++++++++++ Weiferl.Api/Program.cs | 27 ++++++++++++ Weiferl.Api/Properties/launchSettings.json | 41 +++++++++++++++++++ Weiferl.Api/Weiferl.Api.csproj | 24 +++++++++++ Weiferl.Api/appsettings.Development.json | 8 ++++ Weiferl.Api/appsettings.json | 9 ++++ 7 files changed, 160 insertions(+) create mode 100644 Weiferl.Api.sln create mode 100644 Weiferl.Api/Controllers/HelloWorldController.cs create mode 100644 Weiferl.Api/Program.cs create mode 100644 Weiferl.Api/Properties/launchSettings.json create mode 100644 Weiferl.Api/Weiferl.Api.csproj create mode 100644 Weiferl.Api/appsettings.Development.json create mode 100644 Weiferl.Api/appsettings.json diff --git a/Weiferl.Api.sln b/Weiferl.Api.sln new file mode 100644 index 0000000..1c06dcc --- /dev/null +++ b/Weiferl.Api.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33815.320 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Weiferl.Api", "Weiferl.Api\Weiferl.Api.csproj", "{AAB2ADED-1FF6-456B-AB83-B28ECD396244}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AAB2ADED-1FF6-456B-AB83-B28ECD396244}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AAB2ADED-1FF6-456B-AB83-B28ECD396244}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AAB2ADED-1FF6-456B-AB83-B28ECD396244}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AAB2ADED-1FF6-456B-AB83-B28ECD396244}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EEB2FFBB-A035-4B90-ACB1-8DFC3F0AED04} + EndGlobalSection +EndGlobal diff --git a/Weiferl.Api/Controllers/HelloWorldController.cs b/Weiferl.Api/Controllers/HelloWorldController.cs new file mode 100644 index 0000000..c1845ec --- /dev/null +++ b/Weiferl.Api/Controllers/HelloWorldController.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Mvc; +using Weiferl.Databas.EF; +using Weiferl.Databas.EF.Models; + +namespace WeiFerL.Api.Controllers +{ + [ApiController] + [Route("api")] + public class HelloWorldController : ControllerBase + { + private HardwareShopContext _dbContext = new HardwareShopContext(); + + [HttpGet("helloworld")] + public IActionResult Get() + { + return Ok("Hello World"); + } + [HttpGet("pups")] + public IActionResult GetAll() + { + var gk = _dbContext.Hersteller.ToList(); + return Ok(gk); + } + + } +} diff --git a/Weiferl.Api/Program.cs b/Weiferl.Api/Program.cs new file mode 100644 index 0000000..2b4ac80 --- /dev/null +++ b/Weiferl.Api/Program.cs @@ -0,0 +1,27 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +//builder.WebHost.UseUrls("http://192.168.0.57:3045"); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +//app.Run("http://192.168.0.57:3045"); +app.Run(); diff --git a/Weiferl.Api/Properties/launchSettings.json b/Weiferl.Api/Properties/launchSettings.json new file mode 100644 index 0000000..a1d0113 --- /dev/null +++ b/Weiferl.Api/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:63766", + "sslPort": 44368 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5129", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7090;http://localhost:5129", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Weiferl.Api/Weiferl.Api.csproj b/Weiferl.Api/Weiferl.Api.csproj new file mode 100644 index 0000000..1e38b2f --- /dev/null +++ b/Weiferl.Api/Weiferl.Api.csproj @@ -0,0 +1,24 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + + + + ..\..\Weiferl.Databas.EF\Weiferl.Databas.EF\bin\Debug\net6.0\Weiferl.Databas.EF.dll + + + + diff --git a/Weiferl.Api/appsettings.Development.json b/Weiferl.Api/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/Weiferl.Api/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/Weiferl.Api/appsettings.json b/Weiferl.Api/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/Weiferl.Api/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +}