Browse Source

Erster Zwischenstand für die Ausleihe-Schnittstelle (mit Mock-Data)

api/leihvorgang  -- gibt Liste aller Leihvorgänge zurück
api/leihvorgang/{id} -- gibt bestimmten Leihvorgang zurück
ControllerJonas
Jonas Schönbach 2 years ago
parent
commit
fbe1e58a47
  1. 13
      .idea/.idea.BuecherwurmAPI.dir/.idea/.gitignore
  2. 8
      .idea/.idea.BuecherwurmAPI.dir/.idea/.idea.BuecherwurmAPI.dir.iml
  3. 4
      .idea/.idea.BuecherwurmAPI.dir/.idea/encodings.xml
  4. 8
      .idea/.idea.BuecherwurmAPI.dir/.idea/indexLayout.xml
  5. 6
      .idea/.idea.BuecherwurmAPI.dir/.idea/misc.xml
  6. 6
      .idea/.idea.BuecherwurmAPI.dir/.idea/vcs.xml
  7. 7
      .idea/.idea.BuecherwurmAPI.dir/riderModule.iml
  8. 34
      Controllers/LendController.cs
  9. 39
      Controllers/WeatherForecastController.cs
  10. 11
      Data/ILendRepo.cs
  11. 26
      Data/MockLendRepo.cs
  12. 13
      Models/Lend.cs
  13. 4
      Properties/launchSettings.json
  14. 15
      WeatherForecast.cs
  15. BIN
      bin/Debug/netcoreapp3.1/BuecherwurmAPI
  16. 3320
      bin/Debug/netcoreapp3.1/BuecherwurmAPI.deps.json
  17. BIN
      bin/Debug/netcoreapp3.1/BuecherwurmAPI.dll
  18. BIN
      bin/Debug/netcoreapp3.1/BuecherwurmAPI.pdb
  19. 8
      bin/Debug/netcoreapp3.1/BuecherwurmAPI.runtimeconfig.dev.json
  20. 12
      bin/Debug/netcoreapp3.1/BuecherwurmAPI.runtimeconfig.json
  21. 30
      bin/Debug/netcoreapp3.1/Properties/launchSettings.json
  22. 9
      bin/Debug/netcoreapp3.1/appsettings.Development.json
  23. 10
      bin/Debug/netcoreapp3.1/appsettings.json
  24. 4
      obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs
  25. BIN
      obj/Debug/netcoreapp3.1/BuecherwurmAPI
  26. 22
      obj/Debug/netcoreapp3.1/BuecherwurmAPI.AssemblyInfo.cs
  27. 1
      obj/Debug/netcoreapp3.1/BuecherwurmAPI.AssemblyInfoInputs.cache
  28. 0
      obj/Debug/netcoreapp3.1/BuecherwurmAPI.MvcApplicationPartsAssemblyInfo.cache
  29. 1
      obj/Debug/netcoreapp3.1/BuecherwurmAPI.RazorTargetAssemblyInfo.cache
  30. BIN
      obj/Debug/netcoreapp3.1/BuecherwurmAPI.assets.cache
  31. 1
      obj/Debug/netcoreapp3.1/BuecherwurmAPI.csproj.CoreCompileInputs.cache
  32. 20
      obj/Debug/netcoreapp3.1/BuecherwurmAPI.csproj.FileListAbsolute.txt
  33. BIN
      obj/Debug/netcoreapp3.1/BuecherwurmAPI.csprojAssemblyReference.cache
  34. BIN
      obj/Debug/netcoreapp3.1/BuecherwurmAPI.dll
  35. 1
      obj/Debug/netcoreapp3.1/BuecherwurmAPI.genruntimeconfig.cache
  36. BIN
      obj/Debug/netcoreapp3.1/BuecherwurmAPI.pdb
  37. 0
      obj/Debug/netcoreapp3.1/staticwebassets/BuecherwurmAPI.StaticWebAssets.Manifest.cache
  38. 1
      obj/Debug/netcoreapp3.1/staticwebassets/BuecherwurmAPI.StaticWebAssets.xml
  39. 55
      obj/project.packagespec.json

13
.idea/.idea.BuecherwurmAPI.dir/.idea/.gitignore

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/modules.xml
/contentModel.xml
/projectSettingsUpdater.xml
/.idea.BuecherwurmAPI.iml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

8
.idea/.idea.BuecherwurmAPI.dir/.idea/.idea.BuecherwurmAPI.dir.iml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RIDER_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

4
.idea/.idea.BuecherwurmAPI.dir/.idea/encodings.xml

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

8
.idea/.idea.BuecherwurmAPI.dir/.idea/indexLayout.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ContentModelUserStore">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

6
.idea/.idea.BuecherwurmAPI.dir/.idea/misc.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>

6
.idea/.idea.BuecherwurmAPI.dir/.idea/vcs.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

7
.idea/.idea.BuecherwurmAPI.dir/riderModule.iml

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RIDER_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$/../.." />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

34
Controllers/LendController.cs

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BuecherwurmAPI.Data;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using BuecherwurmAPI.Models;
namespace BuecherwurmAPI.Controllers
{
[Route("api/leihvorgang")]
[ApiController]
public class LendController : ControllerBase
{
private readonly MockLendRepo _mockLendRepo = new MockLendRepo();
//GET api/leihvorgang/
[HttpGet]
public ActionResult<IEnumerable<Lend>> GetAllLends()
{
var lends = _mockLendRepo.GetAllLends();
return Ok(lends);
}
//GET api/leihvorgang/{id}
[HttpGet("{id}")]
public ActionResult<Lend> GetLend(int id)
{
var lend = _mockLendRepo.GetLendById(id);
return Ok(lend);
}
}
}

39
Controllers/WeatherForecastController.cs

@ -1,39 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace BuecherwurmAPI.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
var rng = new Random();
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
})
.ToArray();
}
}
}

11
Data/ILendRepo.cs

@ -0,0 +1,11 @@
using System.Collections.Generic;
using BuecherwurmAPI.Models;
namespace BuecherwurmAPI.Data
{
public interface ILendRepo
{
IEnumerable<Lend> GetAllLends();
Lend GetLendById(int id);
}
}

26
Data/MockLendRepo.cs

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using BuecherwurmAPI.Models;
namespace BuecherwurmAPI.Data
{
public class MockLendRepo : ILendRepo
{
public IEnumerable<Lend> GetAllLends()
{
var lends = new List<Lend>
{
new Lend{Id = 1, Customer = "Nek0", ItemId = 1337, Returned = false, ReturnDate = DateTime.Now},
new Lend{Id = 2, Customer = "Shrubbery", ItemId = 1975, Returned = false, ReturnDate = DateTime.Now},
new Lend{Id = 3, Customer = "Felix", ItemId = 42, Returned = true, ReturnDate = DateTime.Now}
};
return lends;
}
public Lend GetLendById(int id)
{
return new Lend{Id = 1, Customer = "Nek0", ItemId = 1337, Returned = false, ReturnDate = DateTime.Now};
}
}
}

13
Models/Lend.cs

@ -0,0 +1,13 @@
using System;
namespace BuecherwurmAPI.Models
{
public class Lend
{
public int Id { get; set; }
public int ItemId { get; set;}
public DateTime ReturnDate { get; set; }
public string Customer { get; set; }
public bool Returned { get; set; }
}
}

4
Properties/launchSettings.json

@ -12,7 +12,7 @@
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"launchUrl": "api",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
@ -20,7 +20,7 @@
"BuecherwurmAPI": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"launchUrl": "api",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"

15
WeatherForecast.cs

@ -1,15 +0,0 @@
using System;
namespace BuecherwurmAPI
{
public class WeatherForecast
{
public DateTime Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string Summary { get; set; }
}
}

BIN
bin/Debug/netcoreapp3.1/BuecherwurmAPI

Binary file not shown.

3320
bin/Debug/netcoreapp3.1/BuecherwurmAPI.deps.json

File diff suppressed because it is too large

BIN
bin/Debug/netcoreapp3.1/BuecherwurmAPI.dll

Binary file not shown.

BIN
bin/Debug/netcoreapp3.1/BuecherwurmAPI.pdb

Binary file not shown.

8
bin/Debug/netcoreapp3.1/BuecherwurmAPI.runtimeconfig.dev.json

@ -0,0 +1,8 @@
{
"runtimeOptions": {
"additionalProbingPaths": [
"/home/js/.dotnet/store/|arch|/|tfm|",
"/home/js/.nuget/packages"
]
}
}

12
bin/Debug/netcoreapp3.1/BuecherwurmAPI.runtimeconfig.json

@ -0,0 +1,12 @@
{
"runtimeOptions": {
"tfm": "netcoreapp3.1",
"framework": {
"name": "Microsoft.AspNetCore.App",
"version": "3.1.0"
},
"configProperties": {
"System.GC.Server": true
}
}
}

30
bin/Debug/netcoreapp3.1/Properties/launchSettings.json

@ -0,0 +1,30 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:5975",
"sslPort": 44376
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"BuecherwurmAPI": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

9
bin/Debug/netcoreapp3.1/appsettings.Development.json

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

10
bin/Debug/netcoreapp3.1/appsettings.json

@ -0,0 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}

4
obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")]

BIN
obj/Debug/netcoreapp3.1/BuecherwurmAPI

Binary file not shown.

22
obj/Debug/netcoreapp3.1/BuecherwurmAPI.AssemblyInfo.cs

@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("BuecherwurmAPI")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("BuecherwurmAPI")]
[assembly: System.Reflection.AssemblyTitleAttribute("BuecherwurmAPI")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Von der MSBuild WriteCodeFragment-Klasse generiert.

1
obj/Debug/netcoreapp3.1/BuecherwurmAPI.AssemblyInfoInputs.cache

@ -0,0 +1 @@
0848efc0ec02497d4272fec239ac4c6242f14bec

0
obj/Debug/netcoreapp3.1/BuecherwurmAPI.MvcApplicationPartsAssemblyInfo.cache

1
obj/Debug/netcoreapp3.1/BuecherwurmAPI.RazorTargetAssemblyInfo.cache

@ -0,0 +1 @@
ed9291efb2fcd04a6651c23e6d75ec73cb57b20c

BIN
obj/Debug/netcoreapp3.1/BuecherwurmAPI.assets.cache

Binary file not shown.

1
obj/Debug/netcoreapp3.1/BuecherwurmAPI.csproj.CoreCompileInputs.cache

@ -0,0 +1 @@
68abc5d6f4bc3db2a6f02336749f1abec3f13b94

20
obj/Debug/netcoreapp3.1/BuecherwurmAPI.csproj.FileListAbsolute.txt

@ -0,0 +1,20 @@
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/obj/Debug/netcoreapp3.1/BuecherwurmAPI.csprojAssemblyReference.cache
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/obj/Debug/netcoreapp3.1/BuecherwurmAPI.AssemblyInfoInputs.cache
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/obj/Debug/netcoreapp3.1/BuecherwurmAPI.AssemblyInfo.cs
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/obj/Debug/netcoreapp3.1/BuecherwurmAPI.csproj.CoreCompileInputs.cache
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/obj/Debug/netcoreapp3.1/BuecherwurmAPI.MvcApplicationPartsAssemblyInfo.cache
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/bin/Debug/netcoreapp3.1/appsettings.Development.json
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/bin/Debug/netcoreapp3.1/appsettings.json
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/bin/Debug/netcoreapp3.1/Properties/launchSettings.json
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/bin/Debug/netcoreapp3.1/BuecherwurmAPI
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/bin/Debug/netcoreapp3.1/BuecherwurmAPI.deps.json
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/bin/Debug/netcoreapp3.1/BuecherwurmAPI.runtimeconfig.json
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/bin/Debug/netcoreapp3.1/BuecherwurmAPI.runtimeconfig.dev.json
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/bin/Debug/netcoreapp3.1/BuecherwurmAPI.dll
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/bin/Debug/netcoreapp3.1/BuecherwurmAPI.pdb
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/obj/Debug/netcoreapp3.1/BuecherwurmAPI.RazorTargetAssemblyInfo.cache
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/obj/Debug/netcoreapp3.1/staticwebassets/BuecherwurmAPI.StaticWebAssets.Manifest.cache
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/obj/Debug/netcoreapp3.1/staticwebassets/BuecherwurmAPI.StaticWebAssets.xml
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/obj/Debug/netcoreapp3.1/BuecherwurmAPI.dll
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/obj/Debug/netcoreapp3.1/BuecherwurmAPI.pdb
/home/js/git/BuecherwurmAPI/BuecherwurmAPI/obj/Debug/netcoreapp3.1/BuecherwurmAPI.genruntimeconfig.cache

BIN
obj/Debug/netcoreapp3.1/BuecherwurmAPI.csprojAssemblyReference.cache

Binary file not shown.

BIN
obj/Debug/netcoreapp3.1/BuecherwurmAPI.dll

Binary file not shown.

1
obj/Debug/netcoreapp3.1/BuecherwurmAPI.genruntimeconfig.cache

@ -0,0 +1 @@
86c8e15dd33445635927cfaf398408205fd11473

BIN
obj/Debug/netcoreapp3.1/BuecherwurmAPI.pdb

Binary file not shown.

0
obj/Debug/netcoreapp3.1/staticwebassets/BuecherwurmAPI.StaticWebAssets.Manifest.cache

1
obj/Debug/netcoreapp3.1/staticwebassets/BuecherwurmAPI.StaticWebAssets.xml

@ -0,0 +1 @@
<StaticWebAssets Version="1.0" />

55
obj/project.packagespec.json

@ -0,0 +1,55 @@
{
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/js/git/BuecherwurmAPI/BuecherwurmAPI/BuecherwurmAPI.csproj",
"projectName": "BuecherwurmAPI",
"projectPath": "/home/js/git/BuecherwurmAPI/BuecherwurmAPI/BuecherwurmAPI.csproj",
"outputPath": "/home/js/git/BuecherwurmAPI/BuecherwurmAPI/obj/",
"projectStyle": "PackageReference",
"originalTargetFrameworks": [
"netcoreapp3.1"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netcoreapp3.1": {
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netcoreapp3.1": {
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"downloadDependencies": [
{
"name": "Microsoft.AspNetCore.App.Ref",
"version": "[3.1.2, 3.1.2]"
}
],
"frameworkReferences": {
"Microsoft.AspNetCore.App": {
"privateAssets": "none"
},
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/3.1.300/RuntimeIdentifierGraph.json"
}
}
}
Loading…
Cancel
Save