diff --git a/Controllers/LendController.cs b/Controllers/LendController.cs index 6ec0b63..24f20b6 100644 --- a/Controllers/LendController.cs +++ b/Controllers/LendController.cs @@ -34,21 +34,8 @@ namespace BuecherwurmAPI.Controllers //POST api/leihvorgang [HttpPost] - public ActionResult LendsPost(LendSeed lend) + public ActionResult LendsPost(LendPost 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 newId = _repository.insertLendReturningId(lend); if (newId > 0) { diff --git a/DTOs/ItemRead.cs b/DTOs/ItemRead.cs deleted file mode 100644 index e70a016..0000000 --- a/DTOs/ItemRead.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace BuecherwurmAPI.DTOs -{ - public class ItemReadDTO - { - public int BookId { get; set;} - } -} \ No newline at end of file diff --git a/DTOs/LendRead.cs b/DTOs/LendRead.cs deleted file mode 100644 index 0d39ee9..0000000 --- a/DTOs/LendRead.cs +++ /dev/null @@ -1,11 +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; } - } -} \ No newline at end of file diff --git a/Models/Item.cs b/Models/Item.cs index 2726273..dbff417 100644 --- a/Models/Item.cs +++ b/Models/Item.cs @@ -13,5 +13,4 @@ namespace BuecherwurmAPI.Models { public int BookId { get; set; } } - } \ No newline at end of file diff --git a/Models/Lend.cs b/Models/Lend.cs index 6c258f2..50ba663 100644 --- a/Models/Lend.cs +++ b/Models/Lend.cs @@ -17,7 +17,7 @@ namespace BuecherwurmAPI.Models public bool Returned { get; set; } } - public class LendSeed + public class LendPost { public long ItemId {get; set;} diff --git a/Models/LendModel.cs b/Models/LendModel.cs index 80076f4..1a0f5c1 100644 --- a/Models/LendModel.cs +++ b/Models/LendModel.cs @@ -95,7 +95,7 @@ namespace BuecherwurmAPI.Models return null; } - public long insertLendReturningId(LendSeed lend) + public long insertLendReturningId(LendPost lend) { using (var command = _dbConnection.CreateCommand()) {