From 2b0cc81ddc85e90b74de897a7e1870dc2b6a1d5d Mon Sep 17 00:00:00 2001 From: David Renner Date: Thu, 28 May 2020 15:22:45 +0200 Subject: [PATCH] =?UTF-8?q?Interface=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 783 ++++++++++++++++++++++++++++++ .vs/BuecherwurmAPI/v16/.suo | Bin 37376 -> 38912 bytes .vs/slnx.sqlite | Bin 249856 -> 258048 bytes Controllers/InventarController.cs | 7 +- Controllers/LendController.cs | 84 ++++ DTOs/LendRead.cs | 12 + Data/IItemRepo.cs | 13 + Data/ILendRepo.cs | 11 + Data/MockLendRepo.cs | 26 + Models/Lend.cs | 13 + Profiles/LendProfile.cs | 14 + 11 files changed, 960 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 Controllers/LendController.cs create mode 100644 DTOs/LendRead.cs create mode 100644 Data/IItemRepo.cs create mode 100644 Data/ILendRepo.cs create mode 100644 Data/MockLendRepo.cs create mode 100644 Models/Lend.cs create mode 100644 Profiles/LendProfile.cs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ae426e7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,783 @@ + +# 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/.vs/BuecherwurmAPI/v16/.suo b/.vs/BuecherwurmAPI/v16/.suo index bcb13b8eb5761dd4950cba4c68371dd05df66892..f99512756e1d2c298a237f3141ffea316e579778 100644 GIT binary patch literal 38912 zcmeHQ3w#{Kd0!cWv3VGWHvuAyd0VGD=`7ho7RY*Ffn~Xt{78LHSlzAUvrc!Hy*tao zGBuD;H-QkKghzO$KpH|^peZSawmceALJNjq2*gc+7)p4CxDC+o=>I>ntJ_=c-R;Rb zkj#yK|J&Kw+4;VCeLM5bH=}J&&Uo>byN`NFvAG6iFXiJ;rYieb!pq>FWZoa7C`TLj zAAj=6Ck);TfVbo(PzfwmV)#ocl0vQ{N*MHsUZoTF zDxe8os*QNrF0+(LWhda_6o7nWi)Rmi+6c%;-*11>b`Sam=YKNNxZOx+8m=E%3()Yh zPw$Usyq%8gQ2@ifh-*2(aPqbvPy-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TH9@iL66kXah9W=(q6LB#p_8IBq zp7#Htv|1Ko*89J>Y~8qUJ=;|2CR#Xb-x7^IFfp1K-jYaQM-u%ybEib-veFd%KW!LO zLKSFJUvGb>d!oZIccfB@okrFkjYR@`uQRvOSdIn_4Yv*QKE=$bgkc*L3v{L_&1Gm2 z!Eu8D$sLFfJsck~+EWP}p_#jgbe44~p}^-n>&=<I>`(J7{VH9IGB2fK(9{{$~(OOVF7{&hIb z&ViTzm0f|2P|ZGscX%fcgUr9fU*aYogiCymFY=4WTDP%c~T%qSP*sF=1q`(?MT5cFm-Ed-wdamO8;*#oDDC|@c56YTYh|QMd7k*!SjjSW9A?=@Ad>N=_O{Y^+;T)rDc!y;5EfZ?n2T zob3?g!4}bpL>Kxb--kq3dI#p=8TcMN2~WT`;Su--&H)1k;ioVQufwbO_w5DPf*mmi zQRqPOKIL}P^7Yxx>1#H2+1P1ghd|$h0(qrC7PPU##&R3WY_vxp^V@5mjrJt;Z5L}_ duZ=x6cH0=WahvkQ`Q>k)U#4^CmmOcd_FopS5Sjo0 diff --git a/Controllers/InventarController.cs b/Controllers/InventarController.cs index a9fc7b2..2115623 100644 --- a/Controllers/InventarController.cs +++ b/Controllers/InventarController.cs @@ -11,9 +11,9 @@ namespace BuecherwurmAPI.Controllers [ApiController] public class InventarController : ControllerBase { - private readonly IBookRepo _repository; + private readonly IItemRepo _repository; - public InventarController(IBookRepo repository) + public InventarController(IItemRepo repository) { _repository = repository; } @@ -60,10 +60,11 @@ namespace BuecherwurmAPI.Controllers { return NotFound(); } - _repository.DeleteItem(Item); + _repository.DeleteItem(item); return NoContent(); } } } +l \ No newline at end of file diff --git a/Controllers/LendController.cs b/Controllers/LendController.cs new file mode 100644 index 0000000..22e2671 --- /dev/null +++ b/Controllers/LendController.cs @@ -0,0 +1,84 @@ +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 new file mode 100644 index 0000000..5813213 --- /dev/null +++ b/DTOs/LendRead.cs @@ -0,0 +1,12 @@ +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/IItemRepo.cs b/Data/IItemRepo.cs new file mode 100644 index 0000000..307a65d --- /dev/null +++ b/Data/IItemRepo.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using BuecherwurmAPI.Models; + +namespace BuecherwurmAPI.Data +{ + public interface IItemRepo + { + IEnumerable GetAllItems(); + Item GetItemById(int id); + NewItem(Item item); + DeleteItem(int id); + } +} \ No newline at end of file diff --git a/Data/ILendRepo.cs b/Data/ILendRepo.cs new file mode 100644 index 0000000..d392ae6 --- /dev/null +++ b/Data/ILendRepo.cs @@ -0,0 +1,11 @@ +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/MockLendRepo.cs b/Data/MockLendRepo.cs new file mode 100644 index 0000000..717342c --- /dev/null +++ b/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 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/Lend.cs b/Models/Lend.cs new file mode 100644 index 0000000..b740853 --- /dev/null +++ b/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; } + } +} \ No newline at end of file diff --git a/Profiles/LendProfile.cs b/Profiles/LendProfile.cs new file mode 100644 index 0000000..074931c --- /dev/null +++ b/Profiles/LendProfile.cs @@ -0,0 +1,14 @@ +using AutoMapper; +using BuecherwurmAPI.DTOs; +using BuecherwurmAPI.Models; + +namespace BuecherwurmAPI.Profiles +{ + public class LendProfile : Profile + { + public LendProfile() + { + CreateMap(); + } + } +} \ No newline at end of file