Add controller that returns all weapons
This commit is contained in:
parent
136a68bda4
commit
99da683632
@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// Metoda zwraca wszystkie dostępne bronie
|
||||
/// </summary>
|
||||
/// <returns>Lista wszystkich broni w bazie danych</returns>
|
||||
[HttpGet("getAllWeapons")]
|
||||
public async Task<List<WeaponViewModel>> GetWeapons()
|
||||
{
|
||||
return _service.Get().ToList();
|
||||
}
|
||||
}
|
||||
}
|
@ -36,10 +36,6 @@
|
||||
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Controllers\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SessionCompanion.Database\SessionCompanion.Database.csproj" />
|
||||
<ProjectReference Include="..\SessionCompanion.Extensions\SessionCompanion.Extensions.csproj" />
|
||||
|
@ -52,6 +52,12 @@
|
||||
</summary>
|
||||
<returns>true jesli ktoś jest już zalogowany i false jeśli nie</returns>
|
||||
</member>
|
||||
<member name="M:SessionCompanion.Controllers.WeaponController.GetWeapons">
|
||||
<summary>
|
||||
Metoda zwraca wszystkie dostępne bronie
|
||||
</summary>
|
||||
<returns>Lista wszystkich broni w bazie danych</returns>
|
||||
</member>
|
||||
<member name="F:SessionCompanion.Hubs.SessionHub.sessionHubData">
|
||||
<summary>
|
||||
Klasa zawierająca wszystkie dane potrzebne w SignalR odnośnie aktualnej sesji
|
||||
|
Loading…
Reference in New Issue
Block a user