Add project files.

This commit is contained in:
Marcus Ferl 2023-07-08 19:38:59 +02:00
parent 3b695bb847
commit 4c201db61b
7 changed files with 160 additions and 0 deletions

25
Weiferl.Api.sln Normal file
View File

@ -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

View File

@ -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);
}
}
}

27
Weiferl.Api/Program.cs Normal file
View File

@ -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();

View File

@ -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"
}
}
}
}

View File

@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.8" />
<PackageReference Include="MySql.EntityFrameworkCore" Version="7.0.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Weiferl.Databas.EF" Version="1.0.1" />
</ItemGroup>
<ItemGroup>
<Reference Include="Weiferl.Databas.EF">
<HintPath>..\..\Weiferl.Databas.EF\Weiferl.Databas.EF\bin\Debug\net6.0\Weiferl.Databas.EF.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}