SES-130 Create Armor Controller and Endpoint to return all armor

This commit is contained in:
Karol Górzyński 2021-01-07 16:45:54 +01:00
parent 136a68bda4
commit 0c29cb0554
3 changed files with 34 additions and 4 deletions

View File

@ -0,0 +1,28 @@
using Microsoft.AspNetCore.Mvc;
using SessionCompanion.Services.Interfaces;
using SessionCompanion.ViewModels.ArmorViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace SessionCompanion.Controllers
{
[Route("api/armor")]
[ApiController]
public class ArmorController : Controller
{
private readonly IArmorService _service;
public ArmorController(IArmorService service) => _service = service;
/// <summary>
/// Metoda zwraca wszystkie dostępne pancerze
/// </summary>
/// <returns>Lista wszystkich pancerzy w bazie danych</returns>
[HttpGet("getAllArmor")]
public async Task<List<ArmorViewModel>> GetArmors()
{
return _service.Get().ToList();
}
}
}

View File

@ -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" />

View File

@ -4,6 +4,12 @@
<name>SessionCompanion</name>
</assembly>
<members>
<member name="M:SessionCompanion.Controllers.ArmorController.GetArmors">
<summary>
Metoda zwraca wszystkie dostępne pancerze
</summary>
<returns>Lista wszystkich pancerzy w bazie danych</returns>
</member>
<member name="M:SessionCompanion.Controllers.CharacterController.Get(System.Int32)">
<summary>
Metoda zwraca postać ze wskazanym identyfikatorem