From a8a9958c86b088c8c9a37fd50cea02302bde2a88 Mon Sep 17 00:00:00 2001 From: Naumann Date: Thu, 28 May 2020 12:15:26 +0200 Subject: [PATCH] . --- .gitignore | 783 ------------------------------- .vscode/launch.json | 36 -- .vscode/tasks.json | 42 -- BuecherwurmAPI.csproj | 13 - Controllers/KatalogController.cs | 100 ---- Controllers/LendController.cs | 84 ---- DTOs/LendRead.cs | 12 - Data/IBookRepo.cs | 12 - Data/ILendRepo.cs | 11 - Data/KatalogRepo.cs | 26 - Data/MockLendRepo.cs | 26 - Models/Book.cs | 23 - Models/CategoryEnum.cs | 11 - Models/Lend.cs | 13 - Models/LendTypeEnum.cs | 8 - Models/Magazin.cs | 16 - Profiles/LendProfile.cs | 14 - Program.cs | 26 - Properties/launchSettings.json | 30 -- Startup.cs | 60 --- appsettings.Development.json | 9 - appsettings.json | 10 - 22 files changed, 1365 deletions(-) delete mode 100644 .gitignore delete mode 100644 .vscode/launch.json delete mode 100644 .vscode/tasks.json delete mode 100644 BuecherwurmAPI.csproj delete mode 100644 Controllers/KatalogController.cs delete mode 100644 Controllers/LendController.cs delete mode 100644 DTOs/LendRead.cs delete mode 100644 Data/IBookRepo.cs delete mode 100644 Data/ILendRepo.cs delete mode 100644 Data/KatalogRepo.cs delete mode 100644 Data/MockLendRepo.cs delete mode 100644 Models/Book.cs delete mode 100644 Models/CategoryEnum.cs delete mode 100644 Models/Lend.cs delete mode 100644 Models/LendTypeEnum.cs delete mode 100644 Models/Magazin.cs delete mode 100644 Profiles/LendProfile.cs delete mode 100644 Program.cs delete mode 100644 Properties/launchSettings.json delete mode 100644 Startup.cs delete mode 100644 appsettings.Development.json delete mode 100644 appsettings.json diff --git a/.gitignore b/.gitignore deleted file mode 100644 index ae426e7..0000000 --- a/.gitignore +++ /dev/null @@ -1,783 +0,0 @@ - -# Created by https://www.gitignore.io/api/git,rider,linux,csharp,windows,dotnetcore,aspnetcore,visualstudio,visualstudiocode -# Edit at https://www.gitignore.io/?templates=git,rider,linux,csharp,windows,dotnetcore,aspnetcore,visualstudio,visualstudiocode - -### ASPNETCore ### -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ - -# Visual Studio 2015 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUNIT -*.VisualState.xml -TestResult.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# DNX -project.lock.json -project.fragment.lock.json -artifacts/ - -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# TODO: Comment the next line if you want to checkin your web deploy settings -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/packages/* -# except build/, which is used as an MSBuild target. -!**/packages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/packages/repositories.config -# NuGet v3's project.json files produces more ignoreable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -node_modules/ -orleans.codegen.cs - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm - -# SQL Server files -*.mdf -*.ldf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# JetBrains Rider -.idea/ -*.sln.iml - -# CodeRush -.cr/ - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/ - -### Csharp ### -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - -# User-specific files -*.rsuser - -# User-specific files (MonoDevelop/Xamarin Studio) - -# Mono auto generated files -mono_crash.* - -# Build results -[Aa][Rr][Mm]/ -[Aa][Rr][Mm]64/ - -# Visual Studio 2015/2017 cache/options directory -# Uncomment if you have tasks that create the project's static files in wwwroot - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results - -# NUnit -nunit-*.xml - -# Build Results of an ATL Project - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_h.h -*.iobj -*.ipdb -*_wpftmp.csproj - -# Chutzpah Test files - -# Visual C++ cache files - -# Visual Studio profiler - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace - -# Guidance Automation Toolkit - -# ReSharper is a .NET coding add-in - -# JustCode is a .NET coding add-in - -# TeamCity is a build add-in - -# DotCover is a Code Coverage Tool - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Visual Studio code coverage results - -# NCrunch - -# MightyMoose - -# Web workbench (sass) - -# Installshield output folder - -# DocProject is a documentation generator add-in - -# Click-Once directory - -# Publish Web Output -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted - -# NuGet Packages -# NuGet Symbol Packages -*.snupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files - -# Microsoft Azure Build Output - -# Microsoft Azure Emulator - -# Windows Store app package directories and files -*.appx -*.appxbundle -*.appxupload - -# Visual Studio cache files -# files ending in .cache can be ignored -# but keep track of directories ending in .cache -!?*.[Cc]ache/ - -# Others - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) - -# RIA/Silverlight projects - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.ndf - -# Business Intelligence projects -*.rptproj.rsuser -*- [Bb]ackup.rdl -*- [Bb]ackup ([0-9]).rdl -*- [Bb]ackup ([0-9][0-9]).rdl - -# Microsoft Fakes - -# GhostDoc plugin setting file - -# Node.js Tools for Visual Studio - -# Visual Studio 6 build log - -# Visual Studio 6 workspace options file - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output - -# Paket dependency manager - -# FAKE - F# Make - -# CodeRush personal settings -.cr/personal - -# Python Tools for Visual Studio (PTVS) - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# BeatPulse healthcheck temp database -healthchecksdb - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ - -### DotnetCore ### -# .NET Core build folders -/bin -/obj - -# Common node modules locations -/node_modules -/wwwroot/node_modules - - -### Git ### -# Created by git for backups. To disable backups in Git: -# $ git config --global mergetool.keepBackup false -*.orig - -# Created by git when using merge tools for conflicts -*.BACKUP.* -*.BASE.* -*.LOCAL.* -*.REMOTE.* -*_BACKUP_*.txt -*_BASE_*.txt -*_LOCAL_*.txt -*_REMOTE_*.txt - -### Linux ### - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -# .nfs files are created when an open file is removed but is still being accessed -.nfs* - -### Rider ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr - -# CMake -cmake-build-*/ - -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - -# File-based project format -*.iws - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -# Editor-based Rest Client -.idea/httpRequests - -# Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser - -### VisualStudioCode ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json - -### VisualStudioCode Patch ### -# Ignore all local history of files -.history - -### Windows ### -# Windows thumbnail cache files -Thumbs.db -Thumbs.db:encryptable -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk - -### VisualStudio ### - -# User-specific files - -# User-specific files (MonoDevelop/Xamarin Studio) - -# Mono auto generated files - -# Build results - -# Visual Studio 2015/2017 cache/options directory -# Uncomment if you have tasks that create the project's static files in wwwroot - -# Visual Studio 2017 auto generated files - -# MSTest test Results - -# NUnit - -# Build Results of an ATL Project - -# Benchmark Results - -# .NET Core - -# StyleCop - -# Files built by Visual Studio - -# Chutzpah Test files - -# Visual C++ cache files - -# Visual Studio profiler - -# Visual Studio Trace Files - -# TFS 2012 Local Workspace - -# Guidance Automation Toolkit - -# ReSharper is a .NET coding add-in - -# JustCode is a .NET coding add-in - -# TeamCity is a build add-in - -# DotCover is a Code Coverage Tool - -# AxoCover is a Code Coverage Tool - -# Visual Studio code coverage results - -# NCrunch - -# MightyMoose - -# Web workbench (sass) - -# Installshield output folder - -# DocProject is a documentation generator add-in - -# Click-Once directory - -# Publish Web Output -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted - -# NuGet Packages -# NuGet Symbol Packages -# The packages folder can be ignored because of Package Restore -# except build/, which is used as an MSBuild target. -# Uncomment if necessary however generally it will be regenerated when needed -# NuGet v3's project.json files produces more ignorable files - -# Microsoft Azure Build Output - -# Microsoft Azure Emulator - -# Windows Store app package directories and files - -# Visual Studio cache files -# files ending in .cache can be ignored -# but keep track of directories ending in .cache - -# Others - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) - -# RIA/Silverlight projects - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) - -# SQL Server files - -# Business Intelligence projects - -# Microsoft Fakes - -# GhostDoc plugin setting file - -# Node.js Tools for Visual Studio - -# Visual Studio 6 build log - -# Visual Studio 6 workspace options file - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) - -# Visual Studio LightSwitch build output - -# Paket dependency manager - -# FAKE - F# Make - -# CodeRush personal settings - -# Python Tools for Visual Studio (PTVS) - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio - -# Telerik's JustMock configuration file - -# BizTalk build output - -# OpenCover UI analysis results - -# Azure Stream Analytics local run output - -# MSBuild Binary and Structured Log - -# NVidia Nsight GPU debugger configuration file - -# MFractors (Xamarin productivity tool) working folder - -# Local History for Visual Studio - -# BeatPulse healthcheck temp database - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 - -# End of https://www.gitignore.io/api/git,rider,linux,csharp,windows,dotnetcore,aspnetcore,visualstudio,visualstudiocode - diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 24247d9..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - // Use IntelliSense to find out which attributes exist for C# debugging - // Use hover for the description of the existing attributes - // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md - "version": "0.2.0", - "configurations": [ - { - "name": ".NET Core Launch (web)", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "build", - // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/BuecherwurmAPI.dll", - "args": [], - "cwd": "${workspaceFolder}", - "stopAtEntry": false, - // Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser - "serverReadyAction": { - "action": "openExternally", - "pattern": "^\\s*Now listening on:\\s+(https?://\\S+)" - }, - "env": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "sourceFileMap": { - "/Views": "${workspaceFolder}/Views" - } - }, - { - "name": ".NET Core Attach", - "type": "coreclr", - "request": "attach", - "processId": "${command:pickProcess}" - } - ] -} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index bc5579d..0000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "label": "build", - "command": "dotnet", - "type": "process", - "args": [ - "build", - "${workspaceFolder}/BuecherwurmAPI.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "publish", - "command": "dotnet", - "type": "process", - "args": [ - "publish", - "${workspaceFolder}/BuecherwurmAPI.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "watch", - "command": "dotnet", - "type": "process", - "args": [ - "watch", - "run", - "${workspaceFolder}/BuecherwurmAPI.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - } - ] -} \ No newline at end of file diff --git a/BuecherwurmAPI.csproj b/BuecherwurmAPI.csproj deleted file mode 100644 index cfb35fd..0000000 --- a/BuecherwurmAPI.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - netcoreapp3.1 - - - - - - - - - diff --git a/Controllers/KatalogController.cs b/Controllers/KatalogController.cs deleted file mode 100644 index 8420953..0000000 --- a/Controllers/KatalogController.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System.Collections.Generic; -using BuecherwurmAPI.Models; -using Microsoft.AspNetCore.Mvc; -using System.Linq; -//using Microsoft.EntityFrameworkCore; -using BuecherwurmAPI.Data; - -namespace BuecherwurmAPI.Controllers -{ - [Route("katalog") ] - [ApiController] - public class KatalogController :ControllerBase - { - private readonly IBookRepo _repository; - - public KatalogController (IBookRepo repository) - { - _repository=repository; - } - // GET Katalog - [HttpGet] - public ActionResult> GetAllBooks() - { - var books =_repository.GetAllBooks(); - return Ok(books); - } - - // POST Katalog - [HttpPost] - public ActionResult> NeuesBuch(Book book) - { - - return Ok(new Book - { - Name = book.Name, - Author= book.Author, - Country= book.Country, - Link= book.Link, - Language= book.Language, - Pages= book.Pages, - Year=book.Year, - ProductId =book.ProductId, - Category= book.Category, - ImageLink =book.ImageLink, - LendTime =book.LendTime, - LendType = book.LendType - }); - } - - - // GET katalog/{id} - [HttpGet("{id}", Name ="GetBookByID")] - public ActionResult > GetBookByID(int id) - { - var book = _repository.GetBookById(id); - if (book != null) - { - return Ok(book); - } - return NoContent(); - - } - - // PUT Katalog/{id} - [HttpPut("id")] - public ActionResult> BuchBearbeiten(Book book) - { - return Ok(new Book - { - Name = book.Name, - Author= book.Author, - Country= book.Country, - Link= book.Link, - Language= book.Language, - Pages= book.Pages, - Year=book.Year, - ProductId =book.ProductId, - Category= book.Category, - ImageLink =book.ImageLink, - LendTime =book.LendTime, - LendType = book.LendType - }); - } - - // DELETE katalog/{id} - [HttpDelete("id")] - public ActionResult> BuchEntfernen (int id) - { - var book = _repository.GetBookById(id); - if(book == null) - { - return NotFound(); - } - _repository.BuchEntfernen(book); - return NoContent(); - } - - } - -} \ No newline at end of file diff --git a/Controllers/LendController.cs b/Controllers/LendController.cs deleted file mode 100644 index 136b429..0000000 --- a/Controllers/LendController.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using AutoMapper; -using BuecherwurmAPI.Data; -using BuecherwurmAPI.DTOs; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.JsonPatch; -using Microsoft.Extensions.Logging; -using BuecherwurmAPI.Models; - -namespace BuecherwurmAPI.Controllers -{ - [Route("api/leihvorgang")] - [ApiController] - public class LendController : ControllerBase - { - private readonly ILendRepo _repository; - private readonly IMapper _mapper; - - public LendController(ILendRepo repository, IMapper mapper) - { - _repository = repository; - _mapper = mapper; - } - - //GET api/leihvorgang - [HttpGet] - public ActionResult> LendsGet() - { - return Ok(_repository.GetAllLends()); - } - - //POST api/leihvorgang - [HttpPost] - public ActionResult LendsPost(Lend lend) - { - /* - Internally a lend is stored with an id - but the client shouldn't be allowed to set or change it - therefore the package 'AutoMapper' is used to prevent errors - that could happen when doing this task manually. - It takes the information from the client and maps it to the - corresponding internal object which then will be returned. - Furthermore it could be used to keep some attributes secret. - Another nice effect of this is that the implementation could be changed - while the interface could be retained by some minor changes in the code. - - DTO stands for Data Transfer Object - */ - var item = new Lend - { - Id = 256, - Customer = lend.Customer, - Returned = lend.Returned, - ItemId = lend.ItemId, - ReturnDate = lend.ReturnDate - }; - return Ok(item); - //return Ok(_mapper.Map(item)); - } - - //GET api/leihvorgang/{id} - [HttpGet("{id}")] - public ActionResult LendById(int id) - { - var lend = _repository.GetLendById(id); - return Ok(lend); - } - - //PATCH api/leihvorgang/{id} - [HttpPatch("{id}")] - public ActionResult LendPatchById(int id, JsonPatchDocument patchDocument) - { - var lend = _repository.GetLendById(id); - if (lend == null) - { - return NotFound(); - } - return Ok(); - } - } -} diff --git a/DTOs/LendRead.cs b/DTOs/LendRead.cs deleted file mode 100644 index 5813213..0000000 --- a/DTOs/LendRead.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace BuecherwurmAPI.DTOs -{ - public class LendReadDTO - { - public int ItemId { get; set;} - public DateTime ReturnDate { get; set; } - public string Customer { get; set; } - public bool Returned { get; set; } - } -} \ No newline at end of file diff --git a/Data/IBookRepo.cs b/Data/IBookRepo.cs deleted file mode 100644 index b81d051..0000000 --- a/Data/IBookRepo.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Collections.Generic; -using BuecherwurmAPI.Models; - -namespace BuecherwurmAPI.Data -{ - public interface IBookRepo - { - IEnumerable GetAllBooks(); - Book GetBookById(int id); - void BuchEntfernen(Book book); - } -} \ No newline at end of file diff --git a/Data/ILendRepo.cs b/Data/ILendRepo.cs deleted file mode 100644 index d392ae6..0000000 --- a/Data/ILendRepo.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Collections.Generic; -using BuecherwurmAPI.Models; - -namespace BuecherwurmAPI.Data -{ - public interface ILendRepo - { - IEnumerable GetAllLends(); - Lend GetLendById(int id); - } -} \ No newline at end of file diff --git a/Data/KatalogRepo.cs b/Data/KatalogRepo.cs deleted file mode 100644 index 055f05d..0000000 --- a/Data/KatalogRepo.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections.Generic; -using BuecherwurmAPI.Models; -using Microsoft.AspNetCore.Mvc; - -namespace BuecherwurmAPI.Data -{ - public class KatalogRepo - { - private readonly object _context; - - public KatalogRepo (object context) - { - _context = context; - } - - /*public IEnumerable GetAllBooks() - { - return _context.books.ToList(); - }*/ - - /*public Book GetBookById(int id) - { - return _context.FirstOrDefault(p => p.Id == id); - }*/ - } -} \ No newline at end of file diff --git a/Data/MockLendRepo.cs b/Data/MockLendRepo.cs deleted file mode 100644 index 717342c..0000000 --- a/Data/MockLendRepo.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using BuecherwurmAPI.Models; - -namespace BuecherwurmAPI.Data -{ - public class MockLendRepo : ILendRepo - { - public IEnumerable GetAllLends() - { - var lends = new List - { - 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}; - } - } -} \ No newline at end of file diff --git a/Models/Book.cs b/Models/Book.cs deleted file mode 100644 index 5304bdc..0000000 --- a/Models/Book.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace BuecherwurmAPI.Models -{ - public class Book - { - public string Name {get; set;} - public string Author {get; set;} - public string Country {get; set;} - public string Link {get; set;} - public string Language {get; set;} - public int Pages {get; set;} - public int Year {get; set;} - [Key] - [Required] - public int ProductId { get; set; } - public CategoryEnum Category { get; set; } - public string ImageLink { get; set; } - public int LendTime {get; set;} - public LendTypeEnum LendType {get; set;} - } - -} \ No newline at end of file diff --git a/Models/CategoryEnum.cs b/Models/CategoryEnum.cs deleted file mode 100644 index 2345e5b..0000000 --- a/Models/CategoryEnum.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace BuecherwurmAPI.Models -{ - public enum CategoryEnum - { - Book, - Magazine, - EBook, - EPaper - } - -} \ No newline at end of file diff --git a/Models/Lend.cs b/Models/Lend.cs deleted file mode 100644 index b740853..0000000 --- a/Models/Lend.cs +++ /dev/null @@ -1,13 +0,0 @@ -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; } - } -} \ No newline at end of file diff --git a/Models/LendTypeEnum.cs b/Models/LendTypeEnum.cs deleted file mode 100644 index 3fdbcb2..0000000 --- a/Models/LendTypeEnum.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace BuecherwurmAPI -{ - public enum LendTypeEnum - { - Physical, - Virtual - } -} \ No newline at end of file diff --git a/Models/Magazin.cs b/Models/Magazin.cs deleted file mode 100644 index 20cbebd..0000000 --- a/Models/Magazin.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace BuecherwurmAPI.Models -{ - public class Magazin - { - public int ProductId {get; set;} - public CategoryEnum Category {get; set;} - public int LendTime {get; set;} - public string Name {get; set;} - public string Run {get; set;} - public string Audience {get; set;} - public string Topic {get; set;} - public LendTypeEnum LendType {get; set;} - } - -} - diff --git a/Profiles/LendProfile.cs b/Profiles/LendProfile.cs deleted file mode 100644 index 074931c..0000000 --- a/Profiles/LendProfile.cs +++ /dev/null @@ -1,14 +0,0 @@ -using AutoMapper; -using BuecherwurmAPI.DTOs; -using BuecherwurmAPI.Models; - -namespace BuecherwurmAPI.Profiles -{ - public class LendProfile : Profile - { - public LendProfile() - { - CreateMap(); - } - } -} \ No newline at end of file diff --git a/Program.cs b/Program.cs deleted file mode 100644 index e60685a..0000000 --- a/Program.cs +++ /dev/null @@ -1,26 +0,0 @@ -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 BuecherwurmAPI -{ - 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(); - }); - } -} diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json deleted file mode 100644 index fa2e929..0000000 --- a/Properties/launchSettings.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "$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" - } - } - } -} diff --git a/Startup.cs b/Startup.cs deleted file mode 100644 index d9a3ef4..0000000 --- a/Startup.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using AutoMapper; -using BuecherwurmAPI.Data; -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 BuecherwurmAPI -{ - 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(); - - // Adds a service that is created once per connection. - // It takes an interface and a specific implementation. - // That allows to swap the implementation easily. - services.AddScoped(); - - services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); - } - - // 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(); - }); - } - } -} diff --git a/appsettings.Development.json b/appsettings.Development.json deleted file mode 100644 index dba68eb..0000000 --- a/appsettings.Development.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - } -} diff --git a/appsettings.json b/appsettings.json deleted file mode 100644 index 81ff877..0000000 --- a/appsettings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "AllowedHosts": "*" -}