From 99da683632a0313c6efdb51b558cd0e196568954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20G=C3=B3rzy=C5=84ski?= Date: Thu, 7 Jan 2021 16:33:29 +0100 Subject: [PATCH] Add controller that returns all weapons --- .../Controllers/WeaponController.cs | 31 +++++++++++++++++++ .../SessionCompanion/SessionCompanion.csproj | 4 --- .../SessionCompanion/SessionCompanion.xml | 6 ++++ 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 SessionCompanion/SessionCompanion/Controllers/WeaponController.cs diff --git a/SessionCompanion/SessionCompanion/Controllers/WeaponController.cs b/SessionCompanion/SessionCompanion/Controllers/WeaponController.cs new file mode 100644 index 0000000..e843808 --- /dev/null +++ b/SessionCompanion/SessionCompanion/Controllers/WeaponController.cs @@ -0,0 +1,31 @@ +using Microsoft.AspNetCore.Mvc; +using SessionCompanion.Extensions.EitherType; +using SessionCompanion.Services.Interfaces; +using System.Threading.Tasks; +using SessionCompanion.ViewModels.WeaponViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using SessionCompanion.ViewModels.ApiResponses; + +namespace SessionCompanion.Controllers +{ + [Route("api/weapon")] + [ApiController] + public class WeaponController : Controller + { + private readonly IWeaponService _service; + public WeaponController(IWeaponService service) => _service = service; + + /// + /// Metoda zwraca wszystkie dostępne bronie + /// + /// Lista wszystkich broni w bazie danych + [HttpGet("getAllWeapons")] + public async Task> GetWeapons() + { + return _service.Get().ToList(); + } + } +} diff --git a/SessionCompanion/SessionCompanion/SessionCompanion.csproj b/SessionCompanion/SessionCompanion/SessionCompanion.csproj index c455a8f..f0f585f 100644 --- a/SessionCompanion/SessionCompanion/SessionCompanion.csproj +++ b/SessionCompanion/SessionCompanion/SessionCompanion.csproj @@ -36,10 +36,6 @@ - - - - diff --git a/SessionCompanion/SessionCompanion/SessionCompanion.xml b/SessionCompanion/SessionCompanion/SessionCompanion.xml index b96a03b..7a8b37b 100644 --- a/SessionCompanion/SessionCompanion/SessionCompanion.xml +++ b/SessionCompanion/SessionCompanion/SessionCompanion.xml @@ -52,6 +52,12 @@ true jesli ktoś jest już zalogowany i false jeśli nie + + + Metoda zwraca wszystkie dostępne bronie + + Lista wszystkich broni w bazie danych + Klasa zawierająca wszystkie dane potrzebne w SignalR odnośnie aktualnej sesji