From d827332311da6c73a81cc7576d3e2d8382d431e5 Mon Sep 17 00:00:00 2001 From: David Renner Date: Thu, 28 May 2020 10:38:21 +0200 Subject: [PATCH] Update: Benennungen angepasst - Copy --> Item --- .vs/slnx.sqlite | Bin 249856 -> 249856 bytes Controllers/InventarController.cs | 32 +++++++++++++++--------------- Models/{Copy.cs => Item.cs} | 6 +++--- 3 files changed, 19 insertions(+), 19 deletions(-) rename Models/{Copy.cs => Item.cs} (58%) diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite index 144b446d76af3426506c2a711436ee55dada0d43..fc5da14c629bf9d3fcafde06258f63a9014e265b 100644 GIT binary patch delta 786 zcmZozz~8Wde}Xil+C&*=MzxIzY5I&on~&=+m1prRNzI*H;J<=}&zL`AvrK>kKUipU zLi`Q^7Cs4n-_0@wW>B%PdNTvoM~SDHe@&ja-iY;)`DLkHn@_B_6ky}AU{K&Fo6LSd zOFW*_kdu+)B$qws2hLf%E=L0k-sinWZK zjEsy-E~z=GC8=Py@SoCE&_nP!g)I!synsq2{UJ)7^7FGNzda!#15&LA;(4ZUi*k$T zc>)y)x6xK5E z4ge~WE{ACHODzX00(wzJ56a;bmNN+UM>WYYCkLdicrs9-kRH$~m;k4+m_d@?X1BAu znJgI?7!-K-vG6hRp5?#AKZj3<_XU3uzaM`L|9aki`~rMmcyI8V^DFS)=ReBl!Dq&Oh_8e%ezVnuG+rN3W_?E2iqzbKoWvs6yppukqP)~RH$El?aiD#ke9VfBh&Tx1 zVwPltgtQkMvmm2qiYEuNC?m*?9+J%FjFaD=5EXUjXI5s6FG?-QFU~Br xz@#Ub^Z=9YAX3kKUipU zLi`Q^7JgqoiOn(vW>B%PdNTvohY9i$T9YTPH)4GlFYzsL^NIDA0&JYM3BPSyxBU3<8eoAR_iD$~>#*?CIdLXCj!Ns^mxkbzj zfvP3_A*w;r5T%L`r4RvbQBDyZ1E4xlM^3P*U>^ewCYiQ)y~)Mu_R;IVVHeO@QVYrgKjAJ?p|M%p>G%yxH;8FGev|#$ZdJ z44UT2iDyjJV5V>iYZ*jXa5FHfH!?%4@JlUCErtfdWWG~+I(o<=MV!KN24Utv4XTZd za5p*T> GetAllCopies() + public ActionResult> GetAllItems() { - var copies = _repository.GetAllCopies(); - return Ok(copies); + var items = _repository.GetAllItems(); + return Ok(items); } // POST Inventar [HttpPost] - public ActionResult> NeuesExemplar(Copy copy) + public ActionResult> NewItem(Item item) { - return Ok(new Copy + return Ok(new Item { - CopyId = copy.CopyId, - ProductId = book.ProductId, + Id = item.Id, + BookId = book.ProductId, }); } // GET Inventar/{id} - [HttpGet("{id}", Name = "GetCopyByID")] - public ActionResult> GetCopyByID(int id) + [HttpGet("{id}", Name = "GetItemByID")] + public ActionResult> GetItemByID(int id) { - var copy = _repository.GetCopyById(id); - if (copy != null) + var item = _repository.GetItemById(id); + if (item != null) { - return Ok(copy); + return Ok(item); } return NoContent(); @@ -53,14 +53,14 @@ namespace BuecherwurmAPI.Controllers // DELETE inventory/{id} [HttpDelete("id")] - public ActionResult> ExemplarEntfernen(int id) + public ActionResult> DeleteItem(int id) { - var copy = _repository.GetCopyById(id); - if (copy == null) + var item = _repository.GetItemById(id); + if (item == null) { return NotFound(); } - _repository.ExemplarEntfernen(copy); + _repository.DeleteItem(Item); return NoContent(); } diff --git a/Models/Copy.cs b/Models/Item.cs similarity index 58% rename from Models/Copy.cs rename to Models/Item.cs index 4ed14cb..c6e6012 100644 --- a/Models/Copy.cs +++ b/Models/Item.cs @@ -2,13 +2,13 @@ using System.ComponentModel.DataAnnotations; namespace BuecherwurmAPI.Models { - public class Copy + public class Item { [Key] [Required] - public int CopyId { get; set; } + public int Id { get; set; } [Required] - public int ProductId { get; set; } + public int BookId { get; set; } } } \ No newline at end of file