diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..24247d9 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,36 @@ +{ + // 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 new file mode 100644 index 0000000..bc5579d --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "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/Controllers/InventarController.cs b/Controllers/InventarController.cs index 7b38c43..5e8870d 100644 --- a/Controllers/InventarController.cs +++ b/Controllers/InventarController.cs @@ -3,7 +3,7 @@ using BuecherwurmAPI.Models; using Microsoft.AspNetCore.Mvc; using System.Linq; //using Microsoft.EntityFrameworkCore; -using BuecherwurmAPI.Data; + namespace BuecherwurmAPI.Controllers { diff --git a/Controllers/KatalogController.cs b/Controllers/KatalogController.cs index 8420953..6bb34e4 100644 --- a/Controllers/KatalogController.cs +++ b/Controllers/KatalogController.cs @@ -3,7 +3,6 @@ using BuecherwurmAPI.Models; using Microsoft.AspNetCore.Mvc; using System.Linq; //using Microsoft.EntityFrameworkCore; -using BuecherwurmAPI.Data; namespace BuecherwurmAPI.Controllers { diff --git a/Controllers/LendController.cs b/Controllers/LendController.cs index 2c43a1a..813d893 100644 --- a/Controllers/LendController.cs +++ b/Controllers/LendController.cs @@ -3,12 +3,12 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using AutoMapper; -using BuecherwurmAPI.Data; +using BuecherwurmAPI.Models; using BuecherwurmAPI.DTOs; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.JsonPatch; using Microsoft.Extensions.Logging; -using BuecherwurmAPI.Models; + namespace BuecherwurmAPI.Controllers { 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/Data/IBookRepo.cs b/Models/IBookRepo.cs similarity index 87% rename from Data/IBookRepo.cs rename to Models/IBookRepo.cs index b81d051..30fea50 100644 --- a/Data/IBookRepo.cs +++ b/Models/IBookRepo.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using BuecherwurmAPI.Models; -namespace BuecherwurmAPI.Data +namespace BuecherwurmAPI.Models { public interface IBookRepo { diff --git a/Data/IItemRepo.cs b/Models/IItemRepo.cs similarity index 88% rename from Data/IItemRepo.cs rename to Models/IItemRepo.cs index e208ba1..46d7f62 100644 --- a/Data/IItemRepo.cs +++ b/Models/IItemRepo.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using BuecherwurmAPI.Models; -namespace BuecherwurmAPI.Data +namespace BuecherwurmAPI.Models { public interface IItemRepo { diff --git a/Data/ILendRepo.cs b/Models/ILendRepo.cs similarity index 85% rename from Data/ILendRepo.cs rename to Models/ILendRepo.cs index d392ae6..9e12f99 100644 --- a/Data/ILendRepo.cs +++ b/Models/ILendRepo.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using BuecherwurmAPI.Models; -namespace BuecherwurmAPI.Data +namespace BuecherwurmAPI.Models { public interface ILendRepo { diff --git a/Data/IRepository.cs b/Models/IRepository.cs similarity index 90% rename from Data/IRepository.cs rename to Models/IRepository.cs index 9952ee9..6e79a2a 100644 --- a/Data/IRepository.cs +++ b/Models/IRepository.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using BuecherwurmAPI.Models; using Microsoft.EntityFrameworkCore.Metadata.Conventions; -namespace BuecherwurmAPI.Data +namespace BuecherwurmAPI.Models { public interface IRepository { diff --git a/Data/Repository.cs b/Models/Repository.cs similarity index 99% rename from Data/Repository.cs rename to Models/Repository.cs index 66b482d..c69942a 100644 --- a/Data/Repository.cs +++ b/Models/Repository.cs @@ -4,7 +4,7 @@ using BuecherwurmAPI.Models; using Microsoft.Data.Sqlite; using Microsoft.VisualBasic.CompilerServices; -namespace BuecherwurmAPI.Data +namespace BuecherwurmAPI.Models { internal class Repository : IRepository { diff --git a/Data/Tables.cs b/Models/Tables.cs similarity index 62% rename from Data/Tables.cs rename to Models/Tables.cs index ba45809..f3143cb 100644 --- a/Data/Tables.cs +++ b/Models/Tables.cs @@ -1,10 +1,11 @@ -namespace BuecherwurmAPI.Data +namespace BuecherwurmAPI.Models { public static class Tables { public struct Table { public const string Lends = "Lends"; + public const string Katalog = "Katalog"; } } } \ No newline at end of file diff --git a/Startup.cs b/Startup.cs index fe2f200..b6cc4f5 100644 --- a/Startup.cs +++ b/Startup.cs @@ -3,7 +3,6 @@ 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; @@ -12,6 +11,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; +using BuecherwurmAPI.Models; namespace BuecherwurmAPI {