removed obsolete DTOs

This commit is contained in:
nek0 2020-06-03 10:55:39 +02:00
parent 1d49265230
commit f970ccc07e
6 changed files with 3 additions and 37 deletions

View file

@ -34,21 +34,8 @@ namespace BuecherwurmAPI.Controllers
//POST api/leihvorgang //POST api/leihvorgang
[HttpPost] [HttpPost]
public ActionResult<LendReadDTO> LendsPost(LendSeed lend) public ActionResult<LendPost> 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); var newId = _repository.insertLendReturningId(lend);
if (newId > 0) if (newId > 0)
{ {

View file

@ -1,9 +0,0 @@
using System;
namespace BuecherwurmAPI.DTOs
{
public class ItemReadDTO
{
public int BookId { get; set;}
}
}

View file

@ -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; }
}
}

View file

@ -13,5 +13,4 @@ namespace BuecherwurmAPI.Models
{ {
public int BookId { get; set; } public int BookId { get; set; }
} }
} }

View file

@ -17,7 +17,7 @@ namespace BuecherwurmAPI.Models
public bool Returned { get; set; } public bool Returned { get; set; }
} }
public class LendSeed public class LendPost
{ {
public long ItemId {get; set;} public long ItemId {get; set;}

View file

@ -95,7 +95,7 @@ namespace BuecherwurmAPI.Models
return null; return null;
} }
public long insertLendReturningId(LendSeed lend) public long insertLendReturningId(LendPost lend)
{ {
using (var command = _dbConnection.CreateCommand()) using (var command = _dbConnection.CreateCommand())
{ {