diff --git a/Sources/API_LoL/Controllers/ChampionsController.cs b/Sources/API_LoL/Controllers/ChampionsController.cs index 69e0b8b..e89d098 100644 --- a/Sources/API_LoL/Controllers/ChampionsController.cs +++ b/Sources/API_LoL/Controllers/ChampionsController.cs @@ -137,15 +137,31 @@ namespace API_LoL.Controllers } // PUT api//5 - [HttpPut("{id}")] - public void Put(int id, [FromBody] string value) + [HttpPut("name")] + public async Task Put(string name, ChampionDTO championDTO) { + if(string.IsNullOrEmpty(name)) + return BadRequest(); + if(championDTO == null) + return UnprocessableEntity(); + var list = await ChampionsManager.GetItemsByName(name, 0, 1); + if (list.Count() == 1) + { + return Ok(ChampionsManager.UpdateItem(list.First(), championDTO.ToChampion())); + } + else { return NoContent(); } } // DELETE api//5 - [HttpDelete("{id}")] - public void Delete(int id) + [HttpDelete("name")] + public async Task Delete(string name) { + if (string.IsNullOrEmpty(name)) + return BadRequest(); + var list = await ChampionsManager.GetItemsByName(name, 0, 1); + if(list.Count() == 1){ + return Ok(await ChampionsManager.DeleteItem(list.First())); + }else { return NoContent(); } } } } diff --git a/Sources/API_LoL/champion.db b/Sources/API_LoL/champion.db new file mode 100644 index 0000000..bea5ebd Binary files /dev/null and b/Sources/API_LoL/champion.db differ diff --git a/Sources/API_LoL/champion.db-shm b/Sources/API_LoL/champion.db-shm new file mode 100644 index 0000000..fe9ac28 Binary files /dev/null and b/Sources/API_LoL/champion.db-shm differ diff --git a/Sources/API_LoL/champion.db-wal b/Sources/API_LoL/champion.db-wal new file mode 100644 index 0000000..e69de29